[英]Add more data to series in highchart pie chart
I want to be able to show 'Good' or 'Bad' in a tooltip depending on some data particular to each data in the series. 我希望能够在工具提示中显示“好”或“差”,这取决于该系列中每个数据的特定数据。
Right now I have the following: 现在,我有以下内容:
data: [
['Firefox', 1],
['IE', 2],
['Safari', 3],
['Opera', 4],
['Others', 5]
]
How could I add another member into that array, for example: 我如何将另一个成员添加到该数组中,例如:
['Firefox', 1, 'Good']
So that I could reference it in the tooltip such as: 这样我就可以在工具提示中引用它,例如:
tooltip: {
pointFormat: '{series.good_or_bad}: <b>{point.percentage:.1f}%</b>'
},
I would do this by using tooltip formatter 我会通过使用工具提示格式化程序来做到这一点
there are 2 approaches with it 有2种方法
use tooltip > formatter with your own validations 使用工具提示>格式化程序进行自己的验证
tooltip: { formatter : function(){ //your validations here to decide good or bad } } 工具提示:{formatter:function(){//您在此处进行的验证,以决定好坏}}
pass the addl details with the data point and access it from tool tip 将addl详细信息与数据点一起传递并从工具提示访问它
pass the data as shown below series:[{ data: [{ name: 'FireFox', y: 1, isGood: 'Good' }] }] 传递数据,如下所示:[{数据:[{名称:'FireFox',y:1,isGood:'Good'}]}]
access it from tooltip as shown below 从工具提示访问它,如下所示
tooltip:{
formatter: function() {
this.point.options.isGood
}
}
Hope one of these approaches will give a solution to you 希望这些方法之一能为您提供解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.