R Highcharter-共享的工具提示(和各种工具提示参数)不起作用

时间:2019-08-23 15:15:22

标签: r r-highcharter

我正在尝试使用highcharter绘制一些时间序列数据:

volumes <- structure(list(priorDate = structure(c(18125, 18126, 18127, 18128, 
18129, 18130), class = "Date"), s_1_1 = c(18481L, 18503L, 18247L, 
17994L, 17755L, 17506L), s_1_2 = c(83143L, 83129L, 83160L, 83171L, 
83120L, 83107L), s_1_3 = c(74456L, 74487L, 74510L, 74549L, 74614L, 
74633L), s_1_4 = c(240095L, 240242L, 240416L, 240604L, 240776L, 
241006L), s_2_10 = c(44542L, 44600L, 44605L, 44665L, 44749L, 
44827L), s_2_11 = c(183468L, 183565L, 183628L, 183692L, 183706L, 
183794L), s_2_5 = c(1400L, 1394L, 1415L, 1406L, 1462L, 1415L), 
    s_2_6 = c(1063L, 1041L, 1046L, 1050L, 1093L, 1051L), s_2_7 = c(38073L, 
    38066L, 38021L, 37936L, 37929L, 37875L), s_2_8 = c(19175L, 
    19156L, 19248L, 19345L, 19420L, 19502L), s_2_9 = c(44103L, 
    44052L, 44029L, 43939L, 43817L, 43747L)), row.names = 1:6, class = "data.frame")

自定义工具提示时遇到很多麻烦。我的目标是让工具提示显示所有系列的数据。我以为这可以解决问题:

highchart(type = "stock") %>% 
  hc_add_series(volumes, type = 'line', hcaes(x = priorDate, y = s_1_1), name = 'Prime Enquirer') %>%
  hc_add_series(volumes, type = 'line', hcaes(x = priorDate, y = s_1_2), name = 'Active Enquirer') %>%
  hc_xAxis(type = 'date') %>%
  hc_tooltip(shared = TRUE)

但这与没有hc_tooltip(shared = TRUE)时的绘制方式完全相同。 我也无法获得显示图例的图表。我必须假设我是个白痴,并且缺少一些非常简单的东西。

我将不胜感激。这已经让我很烦了。

0 个答案:

没有答案