【问题标题】:highcharter xaxis crosshair tooltip labeling all series datapointshighcharter xaxis 十字准线工具提示标记所有系列数据点
【发布时间】:2022-01-09 05:32:59
【问题描述】:

当悬停在时间序列上时,我试图在十字准线工具提示上标记所有系列数据点。这是我目前拥有的:

library(highcharter)

highchart() %>%
  hc_chart(
    type = "container", zoomType = "x") %>%
  hc_xAxis(type = "datetime") %>%
  hc_xAxis(
    tickLength = 0, 
    crosshair = TRUE
  ) %>%
  hc_yAxis(
    tickLength = 0, 
    crosshair = TRUE
  ) %>%
  hc_add_series(
    type = "line",
    data = airmiles
  ) %>%
  hc_add_series(
    type = "line",
    data = airmiles/2
  )

这是我想要的(或类似的):

谢谢!

【问题讨论】:

    标签: r highcharts r-highcharter


    【解决方案1】:

    如果您有两个系列并且想在工具提示中同时显示它们,请尝试使用 xAxis.crosshair 和 tooltip.shared。

    tooltip: {
        shared: true,
    },
    xAxis: {
        crosshair: true
    },
    

    现场演示: https://jsfiddle.net/BlackLabel/d4k8yqc7/

    API 参考:

    https://api.highcharts.com/highcharts/xAxis.crosshair

    https://api.highcharts.com/highcharts/tooltip.shared

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-17
      • 2019-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多