2012-11-28 42 views
1

使用高图,我将多个系列添加到现有的图表。添加系列时,我需要能够根据添加的系列来设置或打开工具提示。Highcharts - 仅向某些动态添加的系列添加工具提示

这是我在这里:


widget.chart.addSeries({ 
     data: newSeries, 
     color: color, 
     tooltip: { 
     enabled: true, 
     formatter: function() { 
      return 'test'; 
     } 
     } 
    }); 
+0

它没有按预期的工具提示添加到一个系列 – DanielCW

回答

3

试试这个。

里面chart选项。

tooltip: { 
    formatter: function() { 
     var text = false; 
     if(this.series.name == "GOOG") { 
     // just an example of serie name 
     // you can use index or other data too 
      text = 'test'; 
     } 

     return text; 
    } 
} 

demo