This is not a recent bug; the API has had issue with dimensions in hidden divs for several years (though they are usually the internal dimensions of the chart rather than the external dimensions, so this could be a new manifestation of an existing problem). The standard recommendation is to do one of two things: either unhide the container immediately prior to drawing and set up a "ready" event handler that hides the div when the chart is finished drawing (in practice, the user generally does not see the chart flash on the page, as drawing is quite fast), or draw the chart only when the div is first unhidden.
On Wednesday, August 21, 2013 11:33:11 AM UTC-4, Lauri Carpenter wrote: > > I use ajax to build various visualizations asynchronously. A container > div on the page is either in the open or closed state when the page is > loaded (state preserved via cookies), meaning that the contents of that div > are either visible (open) or not-visible (style="visibility:hidden; > display:none"). > > If the container div is open when the chart.draw(data, opts) is invoked, > then the height and width specified in the opts is respected and the chart > is the correct size. > > BUT, if the container div is closed when the chart.draw(data, opts) is > invoked, and the viewer then later clicks on the button to open the div > (change its style to "visibility:visible; display:''"), the chart that has > been drawn does NOT respect the height and width specified. It is always > 400x200 pixels, no matter what I specify in the opts. > > This is a recent phenomena, but I do not know exactly when it started. > > Has anybody else seen this? Is this a recent bug? Do I need to specify > something other than height and width? If this is a bug, how do I report > it? > > Thanks in advance, > lauri > > > -- 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. For more options, visit https://groups.google.com/groups/opt_out.
