So I've been working with google charts for a while, but I want a
selecthandler when I click on a slice of my piechart. The 'ready' handler
does work, but the 'select' handler doesnt.
I hope you guys got an idea whats wrong with my code.
google.load("visualization", "1", {packages:["corechart", 'controls']});
var chart, data;
function ajax_pie_chart_call(data, limit) {
var data2 = google.visualization.arrayToDataTable(data);
// Define a slider control for the 'Donuts eaten' column
var slider = new google.visualization.ControlWrapper({
'controlType': 'NumberRangeFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': data[0][1],
'backgroundColor':'#ccc',
'ui': {'labelStacking': 'vertical'}
}
});
// Define a pie chart
var piechart = new google.visualization.ChartWrapper({
'chartType': 'PieChart',
'containerId': 'piechart',
'options': {
'backgroundColor': {'fill':'#f1f1f1', 'strokeWidth':0,
'stroke':'#f1f1f1'},
'width': '50%',
'height': 500,
'legend': 'right',
'chartArea': {'left': 15, 'top': 15, 'right': 0, 'bottom': 0},
'pieSliceText': 'value'
}
});
// $("#control1").show();
// Create the dashboard & Draw the chart
var chart = new
google.visualization.Dashboard(document.getElementById('piechart_total')).bind(slider,
piechart);
function selectHandler() {
alert('test');
}
google.visualization.events.addListener(chart, 'select',
selectHandler);
chart.draw(data2);
}
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.