Hi Jean-Yves,

Problems with drawing multiple charts on a page comes up regularly, and 
it's usually because of the way scripts work. 

To show all the charts, you need to either wait until each chart fires its 
ready event - 
https://developers.google.com/chart/interactive/docs/events#the-ready-event 
or add a setTimeout function with the timer set to 0. As far as I know, the 
0 time does not mean "do it now", it means "do it as soon as there's 
nothing else to be done"

I've tried to explain this in the section Multiple Data Tables, Multiple 
Charts at http://brisray.com/google-charts/multiple.htm

myString is an array of objects that contains everything needed to draw the 
charts.

var strLength = myString.length;
for (i=0; i < strLength; i++){
processChart(i);
}
    function processChart(i) { 
  setTimeout(function() { 
  function drawVisualization() {
var newString = myString[i]
  google.visualization.drawChart(newString);
  }
  google.charts.setOnLoadCallback(drawVisualization); 
  }, 0); 
}

Probably the only limit to how many charts you can have on a page is due to 
memory. https://indstate.edu/business/metrics has 24 charts on the page and 
uses a single event listener - pinched from 
https://www.kirupa.com/html5/handling_events_for_many_elements.htm

On Wednesday, March 17, 2021 at 9:49:35 AM UTC-4 Jean-Yves LEGRAS wrote:

> Hey,
>
> Do you know how to display some graph tanks to a while like that : 
>
> while ($i <= 3) {
>     $i++;  
>     /* La valeur affichée est $i avant 
> l'incrémentation(post-incrémentation)  */
>     echo $i;
>     echo '<div id="curve_chart" style="width: auto; height: auto"></div>';
> }
>
> It doesn't work so I don't know how 
>
> Thanks for your answers
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/73193b12-d696-4a1a-8abd-85256be69a30n%40googlegroups.com.

Reply via email to