Horizontal crosshairs for multiple series

ⅰ亾dé卋堺 提交于 2019-12-12 01:46:53

问题


It seems like when I enable crosshair for the yAxis, only the last series defined get a crosshair. I would like all of them to be crosshaired.

(.. and I would love if they also had the color (or preferably a darker variant) as the series.)


回答1:


You can create an y axis per series, link those additional axes to the first one and define a specific crosshair in each axis - then link series with a specific axis and you will get an seperate customizable crosshair per series.

Highcharts.chart('container', {
    yAxis: [{
      gridLineWidth: 0,
      crosshair: {
        width: 2,
        color: Highcharts.getOptions().colors[0]
      }
    }, {
      linkedTo: 0,
      crosshair: {
        width: 2,
        color: Highcharts.getOptions().colors[1]
      },
      visible: false
    }],

    tooltip: {
      shared: true
    },

    series: [{
        data: data.slice()
    }, {
      yAxis: 1,
      data: data.reverse()
    }]
});

example: http://jsfiddle.net/absuLu6h/



来源:https://stackoverflow.com/questions/41744913/horizontal-crosshairs-for-multiple-series

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!