I made a google chart tools scatter chart/table combination that is
based on their examples. When I click a row in the table, the
corresponding point in the scatter is selected (that's good). But it
is not working in reverse. I cannot select a point in the scatter and
have it select the corresponding row in the table. Does anyone know
why this does not work as expected? my code is provided below:
<html>
<head>
<script type="text/javascript" src="https://www.google.com/
jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart",
"table"]});
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Age', 'Weight'],
[ 8, 12],
[ 4, 5.5],
[ 11, 14],
[ 4, 5],
[ 3, 3.5],
[ 6.5, 7],
[ 6.5, 7]
]);
var options = {
title: 'Age vs. Weight comparison',
hAxis: {title: 'Age', minValue: 0, maxValue: 15},
vAxis: {title: 'Weight', minValue: 0, maxValue: 15},
legend: 'none'
};
var chart = new
google.visualization.ScatterChart(document.getElementById('chart_div'));
var table = new
google.visualization.Table(document.getElementById('table_div'));
chart.draw(data, options);
table.draw(data);
google.visualization.events.addListener(chart, 'select',
function() {
table.setSelection(chart.getSelection());});
google.visualization.events.addListener(table, 'select',
function() {
chart.setSelection(table.getSelection());});
}
google.setOnLoadCallback(drawChart);
</script>
</head>
<body>
<div id="chart_div" style="width: 500px; height: 500px;"></div>
<div id="table_div" style="width: 500px; height: 500px;"></div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
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.