I'm having trouble getting my motion chart to successfully bind to a
controller in a dashboard. In the example below, I've taken the code
from the MotionChart viz documentation and turned it into a dashboard
with one controller. The page displays fine, but choosing an item
from the category filter has no effect on the motion chart.
Ideas?
Thanks!
- Randy
<html>
<head>
<script type="text/javascript" src="https://www.google.com/
jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['corechart',
'controls', 'motionchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Fruit');
data.addColumn('date', 'Date');
data.addColumn('number', 'Sales');
data.addColumn('number', 'Expenses');
data.addColumn('string', 'Location');
data.addRows([
['Apples',new Date (1988,0,1),1000,300,'East'],
['Oranges',new Date (1988,0,1),1150,200,'West'],
['Bananas',new Date (1988,0,1),300,250,'West'],
['Apples',new Date (1989,6,1),1200,400,'East'],
['Oranges',new Date (1989,6,1),750,150,'West'],
['Bananas',new Date (1989,6,1),788,617,'West']
]);
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard_div'));
var locationPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'locationPicker_div',
'options': {
'filterColumnIndex': 4,
}
});
var chart = new google.visualization.ChartWrapper({
'chartType': 'MotionChart',
'containerId': 'chart_div',
'options': {width: 600, height:300}
});
dashboard.bind(locationPicker, chart);
dashboard.draw(data);
}
</script>
</head>
<body>
<div id="dashboard_div">
<div id="locationPicker_div"></div>
<div id="chart_div" style="width: 600px; height: 300px;"></div>
</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 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.
By the way, I tried taking the motion chart out of the dashboard, and
using a listener to redraw it when the controller's state changes.
Still no luck.
In short, either I'm doing something stupid, or there's some extra
tweak needed for resetting motion charts.
Have you gotten motion charts to play nicely in dashboards?
Thanks,
- Randy
We have looked into it shortly and it seems there is indeed an issue. It is possible that the MotionChart assumed that the underlying data table is never changed and therefore changing causes some unexpected behavior.Sorry,
Viz Kid
On Sun, Dec 11, 2011 at 6:23 PM, rtrigg <randy...@gmail.com> wrote:
Yeah, I thought of that. First, it behaves the same whether I run
from localhost or at a remote site. Second, the flash motion chart
works fine initially. I just can't get it to recompute when I make
the selection in the category picker. It's as though the motion chart
is caching the data and the dashboard controller isn't clearing the
data or resetting the flash or whatever needs to happen.
By the way, I tried taking the motion chart out of the dashboard, and
using a listener to redraw it when the controller's state changes.
Still no luck.
In short, either I'm doing something stupid, or there's some extra
tweak needed for resetting motion charts.
Have you gotten motion charts to play nicely in dashboards?
Thanks,
- Randy
--
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.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/kqzxGxdEBlkJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.