Highcharts - multiple yAxis each with its own tooltip

前端 未结 1 1397
耶瑟儿~
耶瑟儿~ 2020-12-19 20:52

Is this possible?

\"crosshairs

I already played with too

相关标签:
1条回答
  • 2020-12-19 21:24

    Using tooltip.positioner in synchronous highcharts can results to required behaviour.

    tooltip: {
          positioner: function(labelWidth, labelHeight, point) {
            var tooltipX, tooltipY;
            tooltipX = point.plotX + this.chart.plotLeft + 20;
            tooltipY = point.plotY + this.chart.plotTop - 20;
            return {
              x: tooltipX,
              y: tooltipY
            };
          }
        }
    

    Fiddle demo modifying synchronized-charts demo

    Update Fix for tooltip hiding at extreme right

    tooltip: {
          positioner: function(labelWidth, labelHeight, point) {
            var tooltipX, tooltipY;
            if (point.plotX > 340) {
              tooltipX = point.plotX + this.chart.plotLeft - 150;
            } else {
              tooltipX = point.plotX + this.chart.plotLeft + 20;
            }
            tooltipY = point.plotY + this.chart.plotTop - 20;
            console.log(tooltipX);
            return {
              x: tooltipX,
              y: tooltipY
            };
          }
        }
    

    Fixed Fiddle

    0 讨论(0)
提交回复
热议问题