Hyperlink the points in scatter plot

90 views
Skip to first unread message

jvdurme

unread,
Sep 9, 2011, 10:49:06 AM9/9/11
to Google Visualization API
Hi all,

I was wondering if it is possible to create hyperlinks from every
point in a scatter plot? These have to open a new page when the point
is clicked. This would be ideal.

Less ideal, but still acceptable, would be to have a hyperlink in the
text bubble appearing next to the dot so I can click on it.

Thanks in advance!

J.

asgallant

unread,
Sep 9, 2011, 2:33:39 PM9/9/11
to google-visua...@googlegroups.com
You can create an event listener for the select event and use the row and column data returned from the event to get the URL information from your DataTable object.  You can then set window.location to the URL and it will be as if the user clicked a link.  As an example:

/*  assumes:
 *    data is the DataTable object
 *    chart is the chart object
 *    URL's are stored as a property, 
named "URL", of the cells
 */
new google.visualization.events.addListener(chart'select'function({
    var selection chart.getSelection()[0];
    window.location data.getProperty(selection.rowselection.column"URL");
});

jvdurme

unread,
Sep 17, 2011, 11:05:44 AM9/17/11
to Google Visualization API
Thanks asgallant, we will try this and I'll let you know how it worked
out. :)

J.
Reply all
Reply to author
Forward
0 new messages