在 HighCharts 中 - 如何让标签和弹出标签引用 HTML 表格的第一列:
我已经添加到这个小提琴: http: //jsfiddle.net/XJ9ck/3/ - 饼图呈现,正确的数字,但它只是不工作的标签。我怀疑这是这里的东西:
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
谢谢你的帮助,
标记
我的代码是:
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/data.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<table id="datatable2">
<thead>
<tr>
<th>Num</th>
<th>Status Reason</th>
</tr>
</thead>
<tbody>
<tr>
<td>Client Action Required</td>
<td>64</td>
</tr>
<tr>
<td>Future Enhancement</td>
<td>8</td>
</tr>
<tr>
<td>Client Hold</td>
<td>3</td>
</tr>
<tr>
<td>Monitoring</td>
<td>11</td>
</tr>
</tbody>
</table>
<div id="container" style="min-width: 400px; height: 500px; margin: 0 auto"></div>
我的 Javascript 是:
$(function () {
$('#container').highcharts({
data: {
table: document.getElementById('datatable2')
},
chart: {
type: 'pie'
},
title: {
text: 'Queue by Person and Status'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
}
, plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
}
}
});
});