Geochart how to stop calls to geocoding when redrawing chart

9 views
Skip to first unread message

Mike Bradley

unread,
May 17, 2017, 9:24:25 AM5/17/17
to Google Visualization API
Hi

I have a geochart on my webpage that has a datatable that contains approx 2000 rows. I have a select input that when the value changes the datatable is refreshed and then i call the draw method to redraw the chart. 
However the issue i have is that once i have selected option from my select input ( the chart is redrawn) - the new datapoints are not added to the chart until after all the other geocode requests have completed for the previous chart(which is now not visible).
Is there a way once i have redrawn the chart to stop any existing geocode requests that relate to the chart that i am getting rid of?


--included on page
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

--declared at top of page in document ready function
google.charts.load('current', { 'packages': ['geochart','map'] });



--when ajax call (called when select list option is changed) returns  i call:

google.charts.setOnLoadCallback(drawMap);


--the drawMap function then has following code:

var chart = new google.visualization.GeoChart(document.getElementById('myDivId'));
chart.draw(dataView, geoChartOptions);




Reply all
Reply to author
Forward
0 new messages