Highlight data point on map via a drop-down select menu

65 views
Skip to first unread message

es

unread,
May 29, 2012, 4:11:34 PM5/29/12
to Google Visualization API
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.

Jinji

unread,
May 30, 2012, 9:09:11 AM5/30/12
to google-visua...@googlegroups.com
Have you tried the setSelection method (see here).


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


E&S Environmental

unread,
May 30, 2012, 2:19:33 PM5/30/12
to google-visua...@googlegroups.com
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!

asgallant

unread,
May 30, 2012, 3:02:03 PM5/30/12
to google-visua...@googlegroups.com
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([{row3column1}]);

// highlight the first and third rows in the table
table.setSelection([
    {row0},
    {row2}
]); 

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!

On Wed, May 30, 2012 at 6:09 AM, Jinji <ji...@google.com> wrote:
Have you tried the setSelection method (see here).

On Tue, May 29, 2012 at 11:11 PM, es <esenvir...@gmail.com> wrote:
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.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages