Highcharts Treemap:在最低级别添加 link
Highcharts Treemap: Add link on lowest level
是否可以在树状图的最低级别添加超链接?
1. Click on Africa
2. Click on Nigeria
3. Click on "Communicable Diseases" should be a link to e.g. www.google.com
有什么想法吗?
你可以这样理解:
1) 将 useHTML 设置为 true
2)捕获数据标签格式化程序
3) 添加条件,通过 isLeaf 标志检查是否为 "last level"
4) Return url 作为
显然,您可以通过在点对象中保留 url 来扩展它。
dataLabels: {
useHTML:true,
enabled: true,
formatter:function(){
if(this.point.isLeaf) {
return '<a href="http://www.google.com" target="_blank">' + this.key + '</div>';
} else {
return this.key;
}
}
},
是否可以在树状图的最低级别添加超链接?
1. Click on Africa
2. Click on Nigeria
3. Click on "Communicable Diseases" should be a link to e.g. www.google.com
有什么想法吗?
你可以这样理解: 1) 将 useHTML 设置为 true 2)捕获数据标签格式化程序 3) 添加条件,通过 isLeaf 标志检查是否为 "last level" 4) Return url 作为
显然,您可以通过在点对象中保留 url 来扩展它。
dataLabels: {
useHTML:true,
enabled: true,
formatter:function(){
if(this.point.isLeaf) {
return '<a href="http://www.google.com" target="_blank">' + this.key + '</div>';
} else {
return this.key;
}
}
},