Highcharts -哑铃工具提示仅显示每个x轴的一个范围

dkqlctbz  于 12个月前  发布在  Highcharts
关注(0)|答案(1)|浏览(101)

我有一个哑铃形的Highcharts图,它显示了一些范围。如果每个“x”轴有多个范围(我的图是倒置的),工具提示只显示每个“类别”的一个范围,不管你把鼠标悬停在哪里。
它发生在重叠和非重叠的范围。
我试着将问题简化为最基本的情况:https://jsfiddle.net/a536ozec/
是我做错了什么,还是有一个我不知道的设置?
配置:

Highcharts.chart('container', {
  "chart": {
    "type": "dumbbell",
    "inverted": true,
  },
  "legend": {
    "enabled": true
  },
  "plotOptions": {
    "series": {
      "marker": {
        "enabled": true
      }
    }
  },
  "series": [
    
    {
      "type": "dumbbell",
      "name": "Test",
      "data": [
        {
          "name": "Test1",
          "low": 1658882324000,
          "high": 1699267066000,
          "v": "A"
        },
        {
          "name": "Test1",
          "low": 1681067066000,
          "high": 1739067066000,
          "v": "B"
        },
        {
          "name": "Test2",
          "low": 1658882324000,
          "high": 1690267066000,
          "v": "C"
        },
        {
          "name": "Test2",
          "low": 1711067066000,
          "high": 1739067066000,
          "v": "D"
        },
        
      ],
      "dashStyle": "Solid",
      "lineWidth": 1,
      "label": {
        "enabled": false
      },
      "visible": true,
      "tooltip": null,
    }
  ],
  "xAxis": {
    "labels": {
      "style": {
        "fontSize": "9px"
      }
    },
    "type": "category",
    "crosshair": true
  },
  "yAxis": {
    "title": {
      "text": "Test range"
    },
    "crosshair": true,
    "labels": {
      "format": "{value:%Y%m%d}"
    }
  },
  "tooltip": {
    "pointFormat": "{point.v} - {point.low:%Y%m%d} - {point.high:%Y%m%d}",
    "enabled": true
  }
  
});`

字符串

vmdwslir

vmdwslir1#

这是因为findNearestPointBy的默认设置是x。作为解决方案,将其设置为xy

series: [
    {
      findNearestPointBy: 'xy',
      ...
    }
  ]

字符串

现场演示:https://jsfiddle.net/BlackLabel/txwmd3z8/
API引用:https://api.highcharts.com/highcharts/series.dumbbell.findNearestPointBy

相关问题