It shouldn't be that hard to implement:
/* this adds a 'select' event listner that removes a point
* from column 1 and adds it to column 2 (which changes
* the point's color)
* assumes:
* data is the DataTable object, with data in column 1 and an empty
column 2
* chart is the Chart object
* options is an object of chart options
* "highlighted" elements that are re-selected stay highlighted
* "highlighted" elements that are not re-selected get returned
* to column 1
*/
new google.events.addListener(chart, 'select', function() {
// only change if data in column 1 is selected
if (data.getSelection()['column'] == 1) {
// return previous highlighted elements to column 1
for (i = 0, i < data.getNumberOfRows; i++) {
if (data.getValue(1, 2) != null) {
data.setValue(i, 1, data.getValue(i, 2));
data.setValue(i, 2, null);
}
}
// add this element to column 2
var row = data.getSelection()['row'];
data.setValue(row, col, null);
data.setValue(row, 2, data.getValue(row, 1));
chart.draw(data, options);
}
});
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/hi1UtDbwPK0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.