Making a lengend clickable

28 views
Skip to first unread message

NP

unread,
Feb 21, 2012, 12:38:32 AM2/21/12
to Google Visualization API
Is it possible to make a line graph legend clickable?

Also can anyone point me to links/documentation for using allowHtml?
I've seen it mentioned in several places but I've been unable to find
the actual explanation of how to use it.

Thanks..

MC Get Vizzy

unread,
Feb 21, 2012, 5:30:32 AM2/21/12
to google-visua...@googlegroups.com
On Tue, Feb 21, 2012 at 7:38 AM, NP <neara...@gmail.com> wrote:
Is it possible to make a line graph legend clickable?

Currently, no.
 

Also can anyone point me to links/documentation for using allowHtml?

That's an option of the Table chart, not the LineChart.
 
I've seen it mentioned in several places but I've been unable to find
the actual explanation of how to use it.

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-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.


asgallant

unread,
Feb 21, 2012, 3:36:44 PM2/21/12
to google-visua...@googlegroups.com
The 'select' event fires when the colored blocks in the legend are clicked.  When hooked into the event handler, the chart's #getSelection method should return a single-element array containing an object with a null 'row' property and a 'column' property corresponding it's index in the underlying DataTable/DataView.  See http://jsfiddle.net/XRwTT/

Neither the legend as a whole nor the individual text entries fire events in the API, though.  If you need to trigger events off of them, it is theoretically possible to do so using standard javascript to dig into the chart container's internal iframe's contents and hook events into the SVG components therein.  This can be problematic as: 

1) it is not easy to identify specific chart components
2) the internals of the charts can change without warning, breaking your code
3) IE uses VML charts instead of SVG, so you would need a separate code path to handle IE.

NP

unread,
Feb 21, 2012, 5:10:34 PM2/21/12
to Google Visualization API
Thanks for the answers

On Feb 21, 12:36 pm, asgallant <drew_gall...@abtassoc.com> wrote:
> The 'select' event fires when the colored blocks in the legend are clicked.
>  When hooked into the event handler, the chart's #getSelection method
> should return a single-element array containing an object with a null 'row'
> property and a 'column' property corresponding it's index in the underlying
> DataTable/DataView.  Seehttp://jsfiddle.net/XRwTT/

Jinji

unread,
Feb 22, 2012, 5:32:02 AM2/22/12
to google-visua...@googlegroups.com
On Tue, Feb 21, 2012 at 10:36 PM, asgallant <drew_g...@abtassoc.com> wrote:
The 'select' event fires when the colored blocks in the legend are clicked.  

Note the the upcoming release will make the event file also when clicking the legend text (not only the colored box next to the legend text).

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.

MC Get Vizzy

unread,
Feb 23, 2012, 4:13:40 AM2/23/12
to google-visua...@googlegroups.com
Sorry for my wrong answer earlier in this thread!

MC Get Vizzy
Reply all
Reply to author
Forward
0 new messages