There are various issues with attempting to draw a chart in a div that is
display:none.

Can you create the chart object but only call draw when the div becomes
visible?

Alternatively, this was brought up as a suggestion in a previous thread:

asgallant:
"""
Set your divs display properties to 'block'.  Before calling the draw()
function of each chart, assign a 'ready' listener for that chart, and have
the listener set the div's display property to 'none'.  Ex:

var chart1 = new google.visualization.BarChart(document.getElementById(
'chart1'));
google.visualization.events.addListener(chart1, 'ready', function () {
    document.getElementById('chart1').style.display = 'none';
});
chart1.draw(data1, options1);

This draws the chart correctly and hides it near instantaneously.  I used
this method on a page with 30+ charts and never noticed any weird problems
or artifacts.
"""


On Thu, Jun 6, 2013 at 11:10 AM, Anthony Carter
<[email protected]>wrote:

> Hello, I am hoping someone can help me out with this issue.
>
> I have a process that runs on page load that gets data and populates a
> google bar chart.  This works fine if I show the chart div the entire time,
> but I am trying to start with the div having a style of "display:none".
> Once the data has all been collected and populated in the chart, I show a
> button on the page.  Clicking that button does a jQuery call to display the
> chart div.
>
> When the chart div loads, the actual chart just says e is null.  Has
> anyone ran into this issue?
>
> Thanks,
> Anthony
>
> --
> 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.
>
>
>

-- 
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