Change Highcharts tooltip formatter from chart Object , after chart is rendered

落爺英雄遲暮 提交于 2019-12-05 01:33:12

You can use chart.tooltip.options.formatter instead, like

chart.tooltip.options.formatter = function() {
    var xyArr=[];
    $.each(this.points,function(){
        xyArr.push('Serie: ' + this.series.name + ', ' +'X: ' + this.x + ', Y: ' +this.y);
    });
    return xyArr.join('<br/>');
}

Changing tooltip formatter dynamically | Highchart & Highstock @ jsFiddle

UPDATE In new (5.0.0+) versions of highcharts, this can also be done using the chart.update() method

  chart.update({
    tooltip: {
      formatter: function() {
        var xyArr = [];
        $.each(this.points, function() {
          xyArr.push('Serie: ' + this.series.name + ', ' + 'X: ' + this.x + ', Y: ' + this.y);
        });
        return xyArr.join('<br/>');
      }
    }
  });

Changing tooltip formatter dynamically with chart.update | Highchart & Highstock @ jsFiddle

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