0
我有一个highchart pie chart具有以下格式标签:如何编辑highchart标签的html?
{point.name} <div class="pct">{point.percentage:.2f}%</div>
但不幸的是,标签被加载时,DIV被删除。
有什么办法可以应用这个类,这样percentajes得到了与标签样式无关的相同外观?
这里是哪里的jsfiddle你可以尝试:http://jsfiddle.net/69x7a/5/
HTML
<div id="container" style="width: 100%; height: 400px;"></div>
CSS
.pct {
color: blue;
font-size: 8px;
}
JS
$(function() {
$('#container').highcharts({
plotOptions: {
pie: {
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '{point.name} <div class="pct">{point.percentage:.2f}%</div>'
}
}
},
series: [{
type: 'pie',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
dataLabels: {
style: {
color: "#ff0000",
fontFamily: 'serif',
fontSize: '17px'
}
}
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
http://jsfiddle.net/6GKCJ/2/ –