[英]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.