Google Charts not displaying in DIV

90 views
Skip to first unread message

Regain 2AControl

unread,
Dec 14, 2023, 8:48:33 AM12/14/23
to Google Visualization API
I have just started using google charts and it works great when a chart is placed in a div on a specific static page, however, I am having an issue with pages within pages loaded with javascript fetch into a panel(div).  Example, index.php chart works fine.  Chart on rightpanel.php fetched into a div in index.php, the chart does not load.  Any thoughts?

Ray Thomas

unread,
Dec 15, 2023, 2:15:38 PM12/15/23
to Google Visualization API
What does the console message in the browser dev tools say? It might be something like "Error: The container #xxxxxxxxxx is not defined." 

The div to hold the chart has to exist before the chart can be drawn.

Regain 2AControl

unread,
Dec 17, 2023, 10:57:29 PM12/17/23
to Google Visualization API
The console is blank.  When I just view the chart.php or team.php with <? include 'chart.php'; ?>, the charts load and the dev tools shows all of the divs and chart data.  When the team.php is fetched and loaded into the "third level" the console is empty and the element panel shows the <div id='chart_div'></div> but it is empty.  It is pulling the div from the two files it is embedded in but the chart isn't generating.  I'm guessing it has something to do with fetching the file and it is loading the content before the chart generates.  Not sure how to combat, I really need this to work on that level.

Regain 2AControl

unread,
Dec 19, 2023, 12:07:30 AM12/19/23
to Google Visualization API
Seems it was the javascript part.  I moved the js to some combined script files and called the functions when loading fetches and the charts came right up.
Reply all
Reply to author
Forward
0 new messages