【发布时间】:2014-08-12 05:54:17
【问题描述】:
我有一个带有日期和整数的 data.frame:
df <- data.frame(date=seq.Date(from=as.Date("2012/01/01"), to=as.Date("2012/02/28"), by="1 day"), y=1:59)
我想用 rCharts nPlot 绘制 data.frame:
n <- nPlot(y ~ date, group = "team", data = df, type = "lineChart")
n$xAxis(
tickFormat = "#!
function(d) {return d3.time.format('%Y-%M-%d')(new Date(d));}
!#",
rotateLabels = -90
)
n
但是 x 轴的格式不正确。
那么如何正确格式化日期呢?
【问题讨论】: