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.
1 Answers
Answers 1
Similar to axisLabelFormatter
there is legendForamtter
. See for examples:
https://github.com/danvk/dygraphs/pull/683 http://dygraphs.com/tests/legend-formatter.html
0 comments:
Post a Comment