The way to check if the library is already loaded is to check if google and
google.visualization are defined:if (google && google.visualization) {
alert("yes");
} else {
alert ("no");
}
As for queries from earlier queries coming back, this is a bit strange.
I haven't seen it before, and I can't think of a scenario when it will.
If you believe this is the case, please provide more info.
VizGuy
On Tue, Nov 18, 2008 at 12:56 PM, bl <[EMAIL PROTECTED]> wrote:
>
> I am trying to do several things.
> one I am using google visualization when in a page which is called via
> an Ajax call, and the javscript function is generated by php.
>
> So i have in the main page initialized my google variables:
> /////////////////
> <script type="text/javascript" src="http://www.google.com/jsapi"></
> script>
> <script language="javascript">
> google.load("visualization", "1", {packages:["linechart"]});
> google.setOnLoadCallback(loadVisualizations);
> var g_googleLoaded=0;
> var g_tablesLoaded=0;
> </script>
> /////////////////////
>
> then In the called pages I generate the various javascript functions,
> ////////////////
> <script type="text/javascript">
>
> window.drawChart_Precipitation = function () {
> <create columns>
> <set data here>
> var chart = new google.visualization.LineChart
> (document.getElementById('graph_Precipitation'
>
> )); chart.draw(data, {width: 1000, height: 340, legend:
> 'bottom', title: 'Precipitation'});
>
> }
>
> </script>
>
> <script type="text/javascript">
>
> window.drawChart_Temperature = function () {
> <create columns>
> <set data here>
> var chart = new google.visualization.LineChart
> (document.getElementById('graph_Temperature'
>
> )); chart.draw(data, {width: 1000, height: 340, legend:
> 'bottom', title: 'Temperature'});
>
> }
>
> </script>
>
> ////////////////////////////////////////////////
> there can be up to 10 of these on some pages.
>
> and when the ajax call ends I call a parent function which "load" the
> various charts ...
> <script type="text/javascript">
>
> window.LoadGraphs = function () {
> drawChart_Precipitation()
> drawChart_Temperture()
> ...
>
> }
> </script>
> ////////////////////////////////////////////////
>
> here is what is happening.
> Sometimes the graphs load. Sometimes they don't
> Sometimes they display the data from the previous call....
>
> is there a way to check that the google library is loaded so that i
> will load the graphs?
> is there a way to delete previously sent data so that only the latest
> data is returned?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Visualization 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-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---