Highcharts tooltip background according to line (without setting backgroundColor = null)

前端 未结 1 519
执念已碎
执念已碎 2020-12-20 10:32

I have this exact same issue: Highcharts tooltip background according to line

but the solutions provided here do not work for me because setting backgroundColor to n

1条回答
  •  天涯浪人
    2020-12-20 10:43

    You can wrap Tooltip.refresh() method and change the tooltip's background according to the point's series color.

    const H = Highcharts;
    
    H.wrap(H.Tooltip.prototype, 'refresh', function (p, point, mouseEvents) {
      p.call(this, point, mouseEvents);
    
      const label = this.label;
    
      if (point && label) {
        label.attr({
          fill: point.series.color
        });
      }
    });
    

    example: http://jsfiddle.net/t38x6kug/

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