我正在创建这样的谷歌饼图
var totrefuelList=[{"veId":220,"trName":"Bus 04","totamt":2,"toqt":10.0},{"veId":384,"trName":"KL 20 B 3966","totamt":0,"toqt":430.00},{"veId":385,"trName":"KL 20 7511","totamt":0,"toqt":0.0},{"veId":386,"trName":"KL 20 D 7426","totamt":0,"toqt":0.0},{"veId":387,"trName":"KL 20 C 3985","totamt":0,"toqt":190.0},{"veId":388,"trName":"KL 01 AM 8356","totamt":0,"toqt":90.0},{"veId":389,"trName":"KL 01 C 8247","totamt":0,"toqt":234.0},{"veId":390,"trName":"KL 01 X 4435","totamt":0,"toqt":678.0},{"veId":391,"trName":"KL","totamt":768,"toqt":0.0},{"veId":392,"trName":"KL 20 B 7544","totamt":0,"toqt":67.0},{"veId":393,"trName":"KL","totamt":0,"toqt":0.0},{"veId":394,"trName":"KL","totamt":0,"toqt":460.0},{"veId":395,"trName":"KL","totamt":0,"toqt":56.0},{"veId":396,"trName":"KL","totamt":0,"toqt":78.0},{"veId":397,"trName":"KL","totamt":0,"toqt":890.0},{"veId":399,"trName":"KL","totamt":70,"toqt":88.0},{"veId":400,"trName":"KL 20 B 5478","totamt":0,"toqt":768.0},{"veId":401,"trName":"KL 01 D 6795","totamt":0,"toqt":760.0},{"veId":402,"trName":"KL","totamt":0,"toqt":0.0},{"veId":403,"trName":"KL 20 B 3968","totamt":0,"toqt":776.0},{"veId":398,"trName":"KL","totamt":1,"toqt":329.72972972972974}];
function drawchartfromRefuel()
{
alert("RefuelLength"+totrefuelList.length);
alert("veId:"+totrefuelList[0].veId);
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', '');
data.addRows(totrefuelList.length);
for (var i=0;i<totrefuelList.length;i++)
{
data.setValue(i, 0, totrefuelList[i].trName);
data.setValue(i, 1, totrefuelList[i].toqt);
}
var options = {
title: 'Refuel Trend',
height:'500',
width:'400',
backgroundColor: { fill:'transparent' }
};
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
google.visualization.events.addListener(chart, 'select', selectHandler);
chart.draw(data, options);
}
function selectHandler(e) {
var selection = chart1.getSelection();
var item = selection[0];
alert( item.row)
}
点击饼图中的一个项目,我想得到相应的行号。我该怎么做。我试过了,但是点击它会卡住。如何纠正它??