请您查看此代码,并告诉我为什么我没有将数据加载到highcharts系列数据中,例如:checkedRows[0][2]
data: [checkedRows[0][2], 19000, 60000, 35000, 17000, 10000],
这是我拥有的js代码:
$(function () {
$('#btn').on('click', function() {
var checkCounter = 0;
var checkedRows = [];
$(':checkbox:checked').closest('tr').each(function() {
checkedRows.push(
$(this).find('td:gt(0)').map(function() {
return $(this).html();
}).get()
);
});
$('#container').highcharts({
chart: {
polar: true,
type: 'line'
},
title: {
text: 'Budget vs spending',
x: -80
},
pane: {
size: '80%'
},
xAxis: {
categories: ['Sales', 'Marketing', 'Development', 'Customer Support',
'Information Technology', 'Administration'],
tickmarkPlacement: 'on',
lineWidth: 0
},
yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0
},
tooltip: {
shared: true,
pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>'
},
legend: {
align: 'right',
verticalAlign: 'top',
y: 70,
layout: 'vertical'
},
series: [{
name: 'Allocated Budget',
data: [checkedRows[0][2], 19000, 60000, 35000, 17000, 10000],
pointPlacement: 'on'
}, {
name: 'Actual Spending',
data: [checkedRows[1][2], 39000, 42000, 31000, 26000, 14000],
pointPlacement: 'on'
}]
});
});
我还提醒正确返回的checkedRows[0][1]
,但它在高图数据数组中不起作用
这里的Html
<table border="1" width="100%">
<tbody>
<tr>
<td>
<input type='checkbox' />
</td>
<td>Model 1</td>
<td>43000</td>
<td>19000</td>
<td>63000</td>
<td>20000</td>
<td>60000</td>
<td>12000</td>
</tr>
<tr>
<td>
<input type='checkbox' />
</td>
<td>Model 2</td>
<td>20000</td>
<td>50000</td>
<td>20000</td>
<td>88000</td>
<td>44000</td>
<td>30000</td>
</tr>
</tbody>
</table><br />
由于
答案 0 :(得分:1)