ps. pulling out the slices, animation etc isn't that important. Just the drill down into a 2nd chart per slice and pull back.
thanks
asgallant
unread,
Nov 3, 2013, 10:37:28 AM11/3/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-visua...@googlegroups.com
You can register a "select" event handler on the first chart to drill down into your data and display a second chart (or replace the contents of the first) with the new data. Theres no way to add a "back" button to the charts, so you'll have to add that to your HTML manually. Something like this should get you started:
var chart1 = new google.visualization.PieChart(document.querySelector('#chart_div1')); var chart2 = new google.visualization.PieChart(document.querySelector('#chart_div2'));
google.visualization.events.addListener(chart1, 'select', function () { var selection = chart1.getSelection(); if (selection.length > 0) { var category = groupedData.getValue(selection[0].row, 0); var rows = data.getFilteredRows([{column: 0, value: category}]); var view = new google.visualization.DataView(data); view.setColumns([1, 2]); view.setRows(rows); chart2.draw(view, { height: 400, width: 600 }); } else { chart2.clearChart(); } });