Patrick,

Mixing google.load() and google.charts.load() in the same page is bound to
cause problems.  I wouldn't recommend even trying it.

The packages property is an array, so just list all the packages you need.
 e.g. packages: ['corechart', 'gauge'].


On Wed, Aug 19, 2015 at 12:27 PM, Patrick Beaudan <[email protected]> wrote:

> Daniel, thanks very much for taking a look. What would be the way to call
> all at once for bar charts, bubble charts, line charts? Can I have a call
> to the frozen library and the current library on the same page (that seems
> to work but only partially)?
>
> All seems to work as before on some pages (for instance see
> http://www.beladv.com/strategySummary.php?strategy=AllWeatherUltra_BA),
> where the charts are called using the following script on the page:
>
>  <script type="text/javascript" src="https://www.google.com/jsapi";></script>
>
>  <script type="text/javascript"
> src="charts/portfolioAnalyzer/call_rollingQuarterly.php"></script>
>  <script type="text/javascript"
> src="charts/portfolioAnalyzer/call_quarterlyZscore.php"></script>
>
> etc ...
> But on some other pages I'm getting "draw()" errors and tried to
> incorporate your frozen version with only partial success like so on our
> homepage (www.beladv.com)
>
> <script type="text/javascript" src="
> https://www.gstatic.com/charts/loader.js";></script>   <!-- Google charts:
> Load AJAX API  -->
> <script type="text/javascript" src="https://www.google.com/jsapi";></script>
>   <!-- Google charts: Load AJAX API  -->
>     <script type="text/javascript" src="//
> ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
>     <script type="text/javascript" src="js/script.js"></script>
>     <script type="text/javascript"
> src="charts/homePage/call_subAssetAlloc.php"></script>
> <script type="text/javascript"
> src="charts/homePage/call_NAVgrowth.php"></script>
>     <script type="text/javascript"
> src="charts/homePage/call_riskReturnGauge_small.php"></script> <!-- map of
> drawdowns vs returns -->
>
> To generate the charts we call individual functions for each chart, and
> each function has a call to load, for instance for the last in the list
> above the function is:
>
> google.charts.load("41", {packages:["gauge"]});
> google.charts.setOnLoadCallback(drawChart);
> // google.load("visualization", "1.0", {packages:["gauge"]});
> // google.setOnLoadCallback(drawChart);
>
> function drawChart() {
>     $.ajax({
>         url: "charts/chart_handler.php?chart=risk_return_gauge",
>         dataType:"json",
>         success: function (jsonData) {
>    //        var data = new
> google.visualization.arrayToDataTable(jsonData);   // Create our data
> table out of JSON data loaded from server.
>            var data = new google.visualization.DataTable(jsonData);   //
> Create our data table out of JSON data loaded from server.
>             var options = {
>                 width: 150, height: 150,
>                 yellowFrom: 75, yellowTo: 100,
>                 greenFrom: 25, greenTo: 75,
>                 minorTicks: 5
>             };
>
>             var chart = new
> google.visualization.Gauge(document.getElementById('chart_riskReturnGauge_small'));
>             chart.draw(data, options);
>         }
>     });
> }
>
> while for the chart above that (call_NAVgrowth) the function (which still
> works) is:
>
> google.load('visualization', '1.0', {'packages':['corechart']});     //
> Load the Visualization API and the piechart package.
> google.setOnLoadCallback(drawChart);     // Set a callback to run when
> the Google Visualization API is loaded.
>
> // Callback that creates and populates a data table, instantiates the
> chart, passes in the data and draws it.
> function drawChart() {
>     var jsonData = $.ajax({
>         url: "charts/chart_handler.php?chart=chart_NAVgrowth",
>         dataType:"json",
>         success: function (jsonData) {
>             var data = new google.visualization.DataTable(jsonData);  //
> Create our data table out of JSON data loaded from server.
>
>             var options = {
>                 'lineWidth': 1,
>                 'legend': {position: 'top'},
>                 'backgroundColor':'#f8f8ea', // same color as background
> box
>                 'width':850,
>                 'height':200,
>                 'hAxis': {textStyle: {fontSize:10, color:'black',
> bold:'true'}, viewWindowMode: 'maximized', gridlines: {count:-1} },
>                 'vAxis': {textStyle: {fontSize:10, color:'black'},
> logScale: 'true', gridlines: {count:-1} },
>                 'fontName':'Trebuchet MS'
>             };
>
>             var chart = new
> google.visualization.LineChart(document.getElementById('chart_NAVgrowth'));
>  // Instantiate chart
>             chart.draw(data, options);   // draw chart, passing in some
> options.
>         }
>     });
> }
>
>
> Any idea based on these why the current google chart version would not
> work? We'd rather change the charts to keep current than use frozen
> versions.  However if easy to use the frozen library, how would we change
> the call to load corechart, Gauges etc all at once?
>
> Finally in your chart library, the calls to data tables seem to all be
> something like
> var data = new google.visualization.arrayToDataTable(jsonData);
>
>
> while they used to be simply
> var data = new google.visualization.DataTable(jsonData);
>
> Any reason to use .arrayToDataTable versus .DataTable  in these examples?
>
> Thanks very much for your help!
>
>
>
>
>
> On Wed, Aug 19, 2015 at 8:55 AM, 'Daniel LaLiberte' via Google
> Visualization API <[email protected]> wrote:
>
>> Patrick,
>>
>> In the JavaScript console, I see you are getting the error message:
>> "Uncaught Error: google.charts.load() cannot be called more than once."
>>
>> As it says, the current implementation of google.charts.load() can't be
>> called more than one time in a page, so you'll have to arrange that all
>> packages you'll need are loaded in the one call, and then don't call it
>> again.  We'll fix that in a future version, but for now, it is a limitation
>> you'll have to live with.
>>
>> On Wed, Aug 19, 2015 at 10:44 AM, Patrick Beaudan <[email protected]>
>> wrote:
>>
>>> Thanks very much Daniel. I tire that and other variations on that theme,
>>> but can't make it work in one instance on our site (home page at
>>> www.beladv.com should have this gauge, but it does not come up.
>>>
>>> Strangely I use the same function  to create this gauge on other pages
>>> of my site, and the gauge comes up fine.
>>>
>>> I have similar issues with some line charts. The same line chart
>>> functions work on parts of the site, but no longer work on other parts. If
>>> anyone else is having similar issues I'd appreciate a pointer. I'll
>>> research this more and post a fix when I find what the problem was.
>>>
>>>
>>> On Wednesday, August 19, 2015 at 4:20:51 AM UTC-7, Daniel Buttery wrote:
>>>>
>>>> This isn't tested but from what I understand you would need to modify
>>>> your code as below:
>>>>
>>>> On Wednesday, 19 August 2015 03:02:14 UTC+1, Patrick Beaudan wrote:
>>>>>
>>>>> Does the  *google.charts.load(**'41'**,* {packages: ['corechart']});
>>>>> work for all packages? It seems to not work for me for a gauge chart for
>>>>> instance code below:
>>>>>
>>>>> google.charts.load("41", {packages:["corechart, gauge"]}); google
>>>>> .charts.setOnLoadCallback(drawChart); function drawChart() { $.ajax({
>>>>> url: "charts/chart_handler.php?chart=risk_return_gauge", dataType:"json",
>>>>> success: function (jsonData) { var data = new
>>>>> google.visualization.DataTable(jsonData); // Create our data table out of
>>>>> JSON data loaded from server. var options = { width: 150, height: 150,
>>>>> yellowFrom: 75, yellowTo: 100, greenFrom: 25, greenTo: 75, minorTicks: 5 
>>>>> };
>>>>> var chart = new
>>>>> google.visualization.Gauge(document.getElementById('chart_riskReturnGauge_small'));
>>>>> chart.draw(data, options); } }); }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, July 28, 2015 at 5:11:12 AM UTC-7, Daniel LaLiberte wrote:
>>>>>>
>>>>>> *Introducing Frozen Google Charts*
>>>>>>
>>>>>> When we push out new releases of Google Charts, some of the changes
>>>>>> are big, like entirely new chart types, but other changes are small, like
>>>>>> enhancements to the appearance or behavior of existing charts.
>>>>>>
>>>>>> Many Google Chart creators fine-tune the look and feel of their
>>>>>> charts until it's exactly what they want. Some of those users might feel
>>>>>> more comfortable knowing that their charts will never change, regardless 
>>>>>> of
>>>>>> what improvements we make in the future.  For those users, we're proud to
>>>>>> announce Frozen Google Charts.
>>>>>>
>>>>>> To load a frozen version, you must make some small changes in how
>>>>>> you load the Google Charts packages.  For example, here is the usual
>>>>>> way of loading the stable version and drawing a chart:
>>>>>>
>>>>>> <script type="text/javascript"
>>>>>>
>>>>>> src="https://www.google.com/jsapi";></script>
>>>>>>
>>>>>> <script type="text/javascript">
>>>>>>
>>>>>>    google.load('visualization', '1', {packages: ['corechart']});
>>>>>>
>>>>>>    google.setOnLoadCallback(drawChart);
>>>>>>
>>>>>> </script>
>>>>>>
>>>>>> You'll need to change your code to be like this (changes highlighted
>>>>>> in bold):
>>>>>>
>>>>>> <script type="text/javascript"
>>>>>>
>>>>>>             src="*https://www.gstatic.com/charts/loader.js*
>>>>>> <https://www.gstatic.com/charts/loader.js>"></script>
>>>>>>
>>>>>> <script type="text/javascript">
>>>>>>
>>>>>>    *google.charts.load(**'41'**,* {packages: ['corechart']});
>>>>>>
>>>>>>    *google.charts.setOnLoadCallback*(drawChart);
>>>>>> </script>
>>>>>>
>>>>>>
>>>>>> Note that when you call google.charts.load(), you should not include
>>>>>> the ‘visualization’ parameter, and the version number is a string.
>>>>>> Only version ‘41’ is supported at this time, which corresponds to the
>>>>>> current stable release, and additional frozen versions will be
>>>>>> announced as we push out each new stable release.  More details
>>>>>> about using the frozen version loader will be available here
>>>>>> <https://google-developers.appspot.com/chart/interactive/docs/library_loading_enhancements>
>>>>>> .
>>>>>>
>>>>>>
>>>>>> When you use a frozen version of Google Charts, all charts and
>>>>>> features should work the same as for the stable version it was created
>>>>>> from.  But there are two minor, though important, limitations with
>>>>>> loading frozen versions, which we expect to resolve in the near
>>>>>> future.
>>>>>>
>>>>>>    1. You can only call google.charts.load() one time.  You can
>>>>>>    instead list all the packages that you'll need in one call, so there 
>>>>>> is
>>>>>>    usually no need to make separate calls.
>>>>>>    2. If you are using a ChartWrapper, you must explicitly load all
>>>>>>    the packages you'll need rather than relying on the ChartWrapper to
>>>>>>    automatically load them for you.
>>>>>>
>>>>>> We expect that frozen versions will remain available indefinitely,
>>>>>> though we may retire frozen versions that have security concerns.  We 
>>>>>> will
>>>>>> typically not provide support for frozen versions, except to suggest
>>>>>> upgrading to newer versions.
>>>>>>
>>>>>> Even if you don't plan to use the frozen version 41, it would help
>>>>>> us if you could try it now with your charts and please let us know if you
>>>>>> experience any problems.
>>>>>>
>>>>>> --
>>>>>> Daniel LaLiberte
>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>  -
>>>>>> 978-394-1058
>>>>>> [email protected]   5CC, Cambridge MA
>>>>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>>>>
>>>>> --
>>> 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/d56187d6-accb-40bd-a038-19ce7b3532ff%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/d56187d6-accb-40bd-a038-19ce7b3532ff%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>  - 978-394-1058
>> [email protected] <[email protected]>   5CC, Cambridge MA
>> [email protected] <[email protected]> 9 Juniper Ridge
>> Road, Acton MA
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Google Visualization API" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/google-visualization-api/hBCwxtXYNZ8/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/CAOtcSJNw%2Bewp9VgoJ2mpkHRtfzQw3iKd9U6ecscaMGJ8u6jB2Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJNw%2Bewp9VgoJ2mpkHRtfzQw3iKd9U6ecscaMGJ8u6jB2Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Best Regards,
> Patrick Beaudan
> (415) 839-5239
>
> --
> 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/CACmakz_Ugskj0G%3D%2BN%3DrY4pH6a-iVR2qkncTrV2YXFk%2BT5Z4%2Bmw%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-visualization-api/CACmakz_Ugskj0G%3D%2BN%3DrY4pH6a-iVR2qkncTrV2YXFk%2BT5Z4%2Bmw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA

-- 
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/CAOtcSJPxgavNhHWxKgNRPo1LLPsS2WsSHFrxgFUun4rYz0K%2BwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to