Hi Christi,
I believe your issue stems from the fact that you create a new instance of
MotionChart every time your data refreshes ("query.send(draw);"). I would
advise that you restructure your code as follows:
google.load('visualization', '1', {'packages':['motionchart']});
google.setOnLoadCallback(initialize);
function initialize() {
var query = new google.visualization.Query(
'http://spreadsheets.google.com/pub?key=pbD-qQOd8BSUVbHnvf7AGUQ');
query.setRefreshInterval(10);
// Create only one instance of the chart and pass it to a draw function,
// which will return a function that we will use for the query response.
var chart = new google.visualization.MotionChart(document.getElementById(
'chart_div'));
query.send(draw(chart));
}
function draw(chart) {
// Note that this returns a function.
return function(response) {
if (response.isError()) {
alert('Error in query')
}
var myData = response.getDataTable();
chart.draw(myData, {width: 516, height:410, state:
'{"dimensions":{"iconDimensions":["dim0"]},"nonSelectedAlpha":0.4,"orderedByX":false,"xZoomedDataMax":4102444800000,"iconType":"BUBBLE","showTrails":true,"uniColorForNonSelected":false,"yLambda":1,"duration":{"timeUnit":"Y","multiplier":1},"yZoomedDataMax":2667,"time":"2005","sizeOption":"_UNISIZE","xLambda":1,"xZoomedDataMin":1104537600000,"yZoomedDataMin":906,"stateVersion":3,"xAxisOption":"_TIME","playDuration":15,"iconKeySettings":[],"yAxisOption":"3","yZoomedIn":false,"xZoomedIn":false,"orderedByY":false,"colorOption":"4"}'
, showXMetricPicker:false, showXScalePicker:false, showYScalePicker:false,
showSelectListComponent:false, showSidePanel:false });
};
}
On Thu, Dec 10, 2015 at 2:26 PM Christi <[email protected]> wrote:
> My embedded motion charts keep refreshing after approximately 10 seconds,
> making it impossible to use them.
>
> I created a series of many motion charts to display my data back for a
> global scenario project in 2009. I updated the code at one time between
> then and now when something in the Google Charts stopped working, however
> this strange behavior has just begun.
>
> Take a look here:
> http://www.tellus.org/results/
>
> Now you can see that they do not display properly on our website. However
> if you click on the advanced features, and look at the underlying data
> link, you will see that the Google Sheets have a motion chart that works
> without any problems. For example:
>
> https://docs.google.com/spreadsheets/d/1E5boZCoHrIvwTvbujg6j4rG8V8UmoPte6y8ZQejc4WE/pub
>
> Please help! We need to fix this bug so that our data can be easily
> accessed.
>
> Thanks,
> Christi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/3a03caa8-a01d-4e01-a4d2-aaded06a139a%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/3a03caa8-a01d-4e01-a4d2-aaded06a139a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
[image: unnamed.gif]
•
•
•
•
Sergey Grabkovsky
Software Engineer
Google, Inc
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/CAEwwup5hGM02A5aJ4fKLcbSQu8EzACEqbpGf057D5sh0kveh5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.