对于下面的代码鼠标移出处理程序不起作用,但是当我将鼠标移到相关代码上时工作正常。(由于 chart.draw() 无法正常工作)。伙计们,你们能帮我解决这个问题吗?
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
var options = {
title: 'My Daily Activities',
legend: 'none',
pieSliceText: 'percentage',
slices: { }
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'onmouseout', function(e) {
var slices = options.slices ;
slices[e.row] = {};
options['slices'] = slices;
chart.draw(data,options);
}
); // mouse out end
google.visualization.events.addListener(chart, 'onmouseover', function(e) {
var sliceid= e.row;
console.log("mouse over"+sliceid);
var slices = options.slices ;
slices[e.row] = {offset:0.2};
options['slices'] = slices;
chart.draw(data,options);
}
); // mouse over end
}