output$plot3 <- renderChart2({
dat <- candyData[candyData$candyChoice %in% input$candyChoice, ]
if(!is.na(dat)){
n <- nPlot(freq ~ purchase_month, group = 'candy choice', data=dat, type = "lineChart")
}
})
在我的控制台中打印时,我的日期显示如下:
"2014-04-01" "2014-05-01" "2014-06-01" "2014-07-01" "2014-08-01" "2014-09-01" "2014-10-01"
"2014-11-01" "2014-12-01" "2015-01-01" "2015-02-01" "2015-03-01" "2015-04-01" "2015-05-01"
"2015-06-01" "2015-07-01" "2015-08-01"
有关如何解决这个问题的任何建议都会受到热烈欢迎!
答案 0 :(得分:1)
格式化你的xaxis
n$xAxis(tickFormat ="#! function(d) {return d3.time.format('%Y/%m')(new Date(d*1000*3600*24));} !#")