【发布时间】:2019-10-05 03:35:25
【问题描述】:
希望更改工具提示中日期时间的格式。我成功地为 x 轴做到了,但没有为工具提示。我已阅读文档,找不到关于此的另一个 R 特定主题。
日期位于 datetime_to_timestamp 函数所需的 Highchart 时间戳中。
library(highcharter)
library(tidyverse)
df <- data.frame(dateTime = c(1557705900000,1557705960000,1557706020000,1557706860000,1557706920000),
points = c(5,7,3,2,9))
highchart() %>%
hc_xAxis(type = "datetime", dateTimeLabelFormats = list(day = '%H:%M')) %>%
hc_add_series(df, type = "scatter",
hcaes(x = dateTime, y = points)) %>%
hc_tooltip(crosshairs = TRUE, dateTimeLabelFormats = list(day = '%H:%M'))
# highchart() %>%
# hc_xAxis(type = "datetime", dateTimeLabelFormats = list(day = '%H:%M')) %>%
# hc_add_series(df, type = "scatter",
# hcaes(x = dateTime, y = points)) %>%
# hc_tooltip(crosshairs = TRUE, dateTimeLabelFormats = '%H:%M')
工具提示格式应该类似于 x 轴格式。
有什么想法吗?
【问题讨论】:
标签: r highcharts r-highcharter