You can use graphs from Google Charts, simply by using the image in you
infowindow html
marker.openInfoWindowHtml('<img
src="http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=t:40,60,60
,45,47,75,70,72" height="125" width="200">');
If you want to try using JS Charts, you'll encounter the following
problems:
1. You can't include the JS Charts <script> inside the infowindow HTML.
2. If you put the "chartcontainer" div in the infowindow HTML and the
script outside, the "chartcontainer" div won't exist until a little
while after the openInfoWindowHtml call. If you call
new JSChart('chartcontainer', 'line');
immediately after creating the info window, it will fail.
3. In some versions of the API, the infowindow is handled by an external
module. This module takes a while to load the first time that you open
an infowindow.
To cope with all these problems you should first perform
map.getInfoWindow().show();
immediately after creating your map, to force the infowindow module to
load.
Secondly, you should create the "chartcontainer" div in your infowindow:
marker.openInfoWindowHtml('<div id="chartcontainer"></div>');
Thirdly, wait one millisecond before telling JS Charts to display the
graph:
setTimeout("var myChart = new JSChart('chartcontainer', 'line');
myChart.setDataArray(myData); myChart.draw()", 1);
Because setTimeout executes in global context, everything you use in
your JS Chart call must be global.
I've not tried this, so it might need a bit of tweaking, or there might
be other considerations that I've missed. So probably easier to use
Google Charts if at all possible.
--
Mike Williams
http://econym.org.uk/gmap
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps 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-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---