The #setSelection method takes an array of objects (usually, the array is length 1 [or 0 to clear the selection]). Each object has row and/or column properties, depending on the chart type. These properties tell the chart which associated DataTable row and/or column to look in for the data point to highlight. Each object in the array sets a single point for highlighting, so if you want multiple points highlighted, you would pass multiple objects in the array (though most visualizations only support 1 selected element at a time). Use it like this:
// highlight the data point at (3,1) in the chart
chart.setSelection([{row: 3, column: 1}]);
// highlight the first and third rows in the table
table.setSelection([
{row: 0},
{row: 2}
]);
The #setSelection method probably should only be called after the chart throws its 'ready' event, so any event handlers that use this method should be instantiated inside a 'ready' event handler for the chart:
google.visualization.events.addListener(chart, 'ready', function () {
// instantiate other event listeners here that use the chart.setSelection method
});
On Wednesday, May 30, 2012 2:19:33 PM UTC-4, es wrote:
No, I haven't. Do you think you could provide a small snippet of code as an example? The link to the description wasn't clear to me. Thanks!
Have you tried the setSelection method (see
here).
Hi,
I am currently referencing a fusion table to display my data on a
map. I also have a chart on the side of the map, which displays
chart
data when I click the map point. Below the chart, there is a drop
down menu whereby a user can alternatively select a point by a name
(versus clicking a point on the map). The chart will display that
site name and display the data. However, I would like to know how to
have my data point, on the map, highlight or change colors when a
user
clicks a site name from the drop down menu.
Thanks.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.