Here is what I tried now - and there is no output!

function drawVisualization() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Task', 'Hours per Day'],
    ['Work', 11],
    ['Eat', 2],
    ['Commute', 2],
    ['Watch TV', 2],
    ['Sleep', 7]
  ]);

  // Create and draw the visualization.
  var chart1 = new google.visualization.PieChart(document.getElementById(
'visualization'));
  chart1.draw(data, {title:"So, how was your day?"});

  google.visualization.events.addListener(chart1, 'ready', function () {
    alert('Ready - lets go!');
  });
  
}


Am Samstag, 9. März 2013 19:52:33 UTC+1 schrieb asgallant:
>
> The documentation doesn't say the gauge charts support them, but if you 
> hook up a ready event handler, you will see that it works.
>
> On Saturday, March 9, 2013 1:28:10 PM UTC-5, Daniel K wrote:
>>
>> Hey,
>>
>> thanks for your quick response.
>>
>> Basically I'm not using a Dashboard object because the visualizations do 
>> not really belong together and they are seperated in different "tabs".
>> I already tried a solution like yours. (Also calling a function on 
>> "ready" event that counts how many charts are drawn) The problem is that for
>> example "Gauge"-visualizations do not trigger any event but also cause a 
>> delay while loading... 
>>
>> On Saturday, March 9, 2013 7:08:58 PM UTC+1, asgallant wrote:
>>>
>>> The answer depends on what you are using to draw the charts.  Are they 
>>> all part of a single 
>>> Dashboard<https://developers.google.com/chart/interactive/docs/gallery/controls#dashboardobject>object?
>>>   If so, then you just need to hook up a "ready" event listener on 
>>> the dashboard and you're all set:
>>>
>>> google.visualization.events.addListener(dash, 'ready', function () {
>>>     // all done!
>>> });
>>>
>>> If your charts are separate, then you have to create an object to track 
>>> their ready states of each chart individually and test the state of that 
>>> object in a "ready" event listener for each chart:
>>>
>>> var chartsReady = {
>>>     chart1: false,
>>>     chart2: false,
>>>     chart3: false
>>> };
>>> function allChartsReady () {
>>>     for (var x in chartsReady) {
>>>         if (!chartsReady[x]) {
>>>             // at least one chart isn't ready, so quit
>>>             return false;
>>>         }
>>>     }
>>>     // all charts are ready, 
>>> }
>>> google.visualization.events.addListener(chart1, 'ready', function () {
>>>     chartsReady['chart1'] = true;
>>>     allChartsReady();
>>> });
>>> google.visualization.events.addListener(chart2, 'ready', function () {
>>>     chartsReady['chart2'] = true;
>>>     allChartsReady();
>>> });
>>> google.visualization.events.addListener(chart3, 'ready', function () {
>>>     chartsReady['chart3'] = true;
>>>     allChartsReady();
>>> });
>>>
>>>
>>> On Saturday, March 9, 2013 6:36:18 AM UTC-5, Daniel K wrote:
>>>>
>>>> Hey there,
>>>>
>>>> I'm working on a webpage that uses a lot of diferent Google charts. 
>>>> Consequently it takes a few seconds until all the visualizations are drawn.
>>>> That delay doesn't look great and therefore I just wanted to open a 
>>>> "loading" dialog. For closing that dialog when the visualization is ready 
>>>> I 
>>>> need 
>>>> to know when every chart is drawn. Is there an event for that? How can 
>>>> I access the "building status" of my visualizaions?
>>>>
>>>> Thanks in advance!
>>>>
>>>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to