【发布时间】:2018-04-02 08:18:30
【问题描述】:
我正在使用闪亮包创建仪表板。其中一个应该显示悬停日期的图没有这样做,而是显示日期的十进制值。 日期保存在 as.Date() 函数中的“日期”变量中:
custData$date <- as.Date(custData$date, "%m/%d/%Y")
用于显示绘图的Server.R代码:
output$sidePlot2 <- renderPlotly({print(ggplotly(custData %>%
group_by(date) %>% summarise(revenue = sum(lineTotal)) %>%
ggplot(aes(x = date, y = revenue)) + geom_line() + geom_smooth(method = 'auto', se = FALSE) + labs(x = 'Date', y = 'Revenue (£)', title = 'Overall Revenue Trend by Date')
)
)
}
)
【问题讨论】:
-
可能是日期转换不对,能否分享重现您的数据?
-
尝试使用
devtools::install_github("tidyverse/ggplot2")下载最新版本的ggplot2。我最近遇到了一个类似的问题,并通过从2.2.1(CRAN 版本)升级到2.2.1.9000来解决它