Giter Site home page Giter Site logo

Comments (2)

bthieurmel avatar bthieurmel commented on August 15, 2024

Hi,

This is an example with some StockEvents with stock chart :

### Generate dates ----
start <- as.POSIXct("01-01-2015", format = "%d-%m-%Y")
end <- as.POSIXct("31-01-2015", format = "%d-%m-%Y")
period <- seq.POSIXt(from = start, to = end, by = "hour")


### Generate mesures ----
values <- rnorm(length(period), mean = 500, sd= 200)
data <- data.table(values, date = period)
data[ , date := format(date, "%m-%d-%Y %H:%M:%S")]


amStockChart(theme = "default" , dataDateFormat = "MM-DD-YYYY JJ:NN:SS") %>>% 
  addDataSet(dataSet(title = "Values", categoryField = "date") %>>%
               setDataProvider(data, keepNA = FALSE) %>>%
               addFieldMapping(fromField = "values", toField = "values") %>>%
               addStockEvent(date = "01-02-2015 23:00:00", type = "sign", graph ="g1",
                             text = "Event1", description = "This is an event") %>>%
               addStockEvent(date = "01-15-2015 23:00:00", type = "sign", graph ="g1",
                             text = "Event2", description = "This is a second event")) %>>% 
  addPanel(stockPanel(showCategoryAxis = FALSE, title = "values", percentHeight = 70) %>>%
             addStockGraph(id = "g1", valueField = "values", comparable = TRUE,
                           compareField = "values", balloonText = "[[title]] =<b>[[value]]</b>",
                           compareGraphBalloonText = "[[title]] =<b>[[value]]</b>") %>>% 
             setStockLegend(periodValueTextComparing = "[[percents.value.close]]%",
                            periodValueTextRegular = "[[value.close]]")) %>>% 
  setChartScrollbarSettings(graph = "g1") %>>% 
  setChartCursorSettings(valueBalloonsEnabled = TRUE, fullWidth = TRUE,
                         cursorAlpha = 0.1, valueLineBalloonEnabled = TRUE,
                         valueLineEnabled = TRUE, valueLineAlpha = 0.5) %>>% 
  setCategoryAxesSettings(minPeriod = "ss", maxSeries = 1000) %>>% 
  plot(width = "100%")

from ramcharts.

debsush avatar debsush commented on August 15, 2024

Hi

It works like a charm. I realized my mistake. I missed dataDateFormat = "MM-DD-YYYY JJ:NN:SS"

Wonderful and very happy with the package. Cheers to the whole team

Regards,
SD

from ramcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.