To answer your second question first, no you can't add names to the map.
To answer the first, what is happening is that every time you click a
button, a new wave of "drawNext" recursive calls is generated. If you
click a button once, 5 seconds after the charts change, the *first* instance
of the "drawNext" recursive function continues, and the chart redraws 5
seconds later (and again, 5 seconds after that). You'll have to clear the
old setTimeout call before making a new one; something like this:
http://jsfiddle.net/gZ3t8/1/
Note that the code I gave probably has a bug, where it fails to clear some
chains if the user clicks a button a second time within the changeTime
period. Also, there appears to be a memory leak (or something similar)
when the GeoMaps get drawn; as the loop iterates multiple times, the
loading times of the GeoMaps get longer and longer. You may need to switch
to a different approach (either change the GeoMaps to GeoCharts [generally
recommended, as GeoMaps are deprecated] or draw all the charts once, hiding
and showing them instead of redrawing).
On Thursday, June 7, 2012 7:25:09 AM UTC-4, mrishadali wrote:
>
> And also is there any way to show the country/city names and on the
> geoMap/geoChart. The tooltip is fine but I wanted the names of places on
> the geomap/geochart as well.
> Thanks
>
> On Wednesday, June 6, 2012 3:00:04 PM UTC+1, asgallant wrote:
>>
>> Yes, you can do this. There are a number of ways to do so, but the
>> simplest would be something like this:
>>
>> /* assumes:
>> * charts is an array of ChartWrappers, containing all of the
>> charts in the slideshow
>> * nextSlide is a DOM element that, when clicked, advances to the
>> next slide
>> *
>> * hide all but the first chart
>> */
>> for (var i = 1; i < charts.length; i++) {
>> google.visualization.events.addListener(charts[i], 'ready', (function
>> (x) {
>> return function() {
>> var id = charts[x].getContainerId();
>> document.getElementById(id).style.display = 'none';
>> }
>> })(i));
>> charts[i].draw();
>> }
>>
>> var currentSlide = 0;
>> nextSlide.onclick = function() {
>> if (currentSlide < charts.length - 1) {
>> var id = charts[currentSlide].getContainerId();
>> document.getElementById(id).style.display = 'none';
>> currentSlide++;
>> var id = charts[currentSlide].getContainerId();
>> document.getElementById(id).style.display = 'block';
>> }
>> else {
>> alert('End of slide show');
>> }
>> }
>>
>> On Wednesday, June 6, 2012 8:50:06 AM UTC-4, mrishadali wrote:
>>>
>>> Hi,
>>> I am using geoMaps and geoCharts to show intensity of something
>>> within particular areas and I want to show these maps and charts in a slide
>>> show. Like we show some images in a slideshow.
>>> Is it possible to create a slide show of the div tags in html? Or is
>>> there any other way??
>>> GeoMap and geoCharts are in div tags.
>>> Please help !!!
>>>
>>
--
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/-/UEdJQtXGEFUJ.
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.