I'm charting a time series with dygraphs
in R
like the following:
library(dygraphs)
library(htmlwidgets)
library(data.table)
now <- Sys.time()
dataset <- data.table(time = as.POSIXct(now+1:10),value = 1:10)
d <- dygraph(dataset)
The date format displayed in the legend depends in the machine locale and I cannot leave it fixed.
The labels of the x axis can be formatted as follows:
valueFormatter<-"function formatValue (ms) {
return ms.toISOString();
}"
d <- d%>%dyAxis("x", axisLabelFormatter=JS(valueFormatter))
However, I don't know how to do it for the legend.
Similar to axisLabelFormatter
there is legendForamtter
. See for examples:
https://github.com/danvk/dygraphs/pull/683 http://dygraphs.com/tests/legend-formatter.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With