[英]How to display custom text for a specific category in pie chart tool tip
我有一个饼图,当用户将鼠标悬停在类别上时,我想显示专门针对特定类别的自定义文本。
JS小提琴链接: https : //jsfiddle.net/mewohraz/1/
tooltip: {
pointFormat: '{point.custom} (point.category == 'Internet Explorer) ? 'display customtext'
},
例如,当用户将鼠标悬停在Internet Explorer上时,我想显示项目符号列表。 文本将进行硬编码,因此它不是来自数据系列。
我该怎么做呢?
您可以使用tooltip选项的formatter
功能来定义自己的文本: tooltip.formatter
tooltip: {
formatter: function(){
if(this.point.name == "Internet Explorer")
return "my custom text" ;
else
return '<span style="color: ' + this.point.color + '">' + this.point.name + '</span><br/>' + this.point.custom ;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.