javascript - Google charts mouseover for two charts -


this question concerns working google charts.

i have dataset consisting of categories contribution amounts, bucketed days of month. represent entire month in pie chart, , represent data individual days in stacked bar chart. both charts based on same information. if give both charts information in right order, colors coordinated between 2 (i.e. each category in 1 has same color same category in other).

when hover mouse on pie slice, highlighted. have corresponding data in stacked bar chart highlighted @ same time, , vica versa.

what best way accomplish google visualization api?

use <chart type>#setselection method highlight data points. if understand data structure correctly, should work:

google.visualization.events.addlistener(piechart, 'select', function () {     var selection = piechart.getselection();     if (selection.length) {         // assumes row in piechart's data corresponds data series in columnchart, nth + 1 column         columnchart.setselection([{column: selection[0].row + 1}]);     } }); google.visualization.events.addlistener(columnchart, 'select', function () {     var selection = columnchart.getselection();     if (selection.length) {         // assumes data series in columnchart's data corresponds row in piechart, nth column - 1         piechart.setselection([{column: selection[0].column - 1}]);     } }); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -