Hi, I have added what you recommended but its not working..
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Visit'],
['January', 0],
['February', 1],
['March', 3],
['April', 1],
['May', 2],
['June', 0],
['July', 5],
['August', 3],
['September', 1],
['October', 2],
['November', 0],
['December', 2]
]);
var options = {
title: 'Number of visits'
};
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
google.events.addListener(chart, 'select', function () {
// whatever you want, ex:
window.location.replace("www.google.com")
});
}
</script>
</head>
<body>
<div id="chart_div" style="width: 1200px; height: 500px;"></div>
</body>
</html>
On Friday, July 29, 2011 8:22:35 PM UTC+8, asgallant wrote:
>
> Do you want a link opened when someone clicks a data point, or do you want
> a link added to the popup?
>
> If you want a link opened on click, after you call draw() on your chart
> object, add an event listener for the "select" event and use js to direct
> your navigation from there:
>
> // assuming you have a chart object called "chart"
> google.events.addListener(chart, 'select', function () {
> // whatever you want, ex:
> window.location.href = "http://target.web.site/";
> });
>
> If you want the popups to have links in them, you need to set the
> formatted values of your data. Either call the dataTable method
> #setFormattedValue for each point, or set your values and formatted values
> in object notation when you build your dataTable:
>
> // assuming you have a dataTable object called "data"
> data.setValue(0,1,{v: 6, f: '<a href="http://target.web.site">This is a
> link for value 6</a>'});
>
--
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/-/bdMnCtUuOK4J.
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.