我用图表时间序列dygraphs中R像下面这样:
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)
Run Code Online (Sandbox Code Playgroud)
图例中显示的日期格式取决于机器区域设置,我不能将其保留.
x轴的标签可以格式化如下:
valueFormatter<-"function formatValue (ms) {
return ms.toISOString();
}"
d <- d%>%dyAxis("x", axisLabelFormatter=JS(valueFormatter))
Run Code Online (Sandbox Code Playgroud)
但是,我不知道如何为传奇做到这一点.
类似的axisLabelFormatter还有legendForamtter。请参阅示例:
https://github.com/danvk/dygraphs/pull/683 http://dygraphs.com/tests/legend-formatter.html
| 归档时间: |
|
| 查看次数: |
464 次 |
| 最近记录: |