You need to make the div's visible before drawing the charts. You can hide
them immediately after they finish drawing by using a 'ready' event
handler, like this:
var div = document.getElementById( 'piechart-'+i );
var chart = new google.visualization.PieChart(div);
div.style.display = 'block';
google.visualization.events.addListener(chart, 'ready', function () {
div.style.display = 'none';
});
chart.draw(data, options);
On Wednesday, March 7, 2012 5:04:17 AM UTC-5, Kasper wrote:
>
> Ok, I've figured out a bit more.
> It seems that the mockup was just working fine, because where I am using
> it in the website, it is initially hidden (display:none). When you press a
> button, the piecharts are shown (display:block).
> So when you refresh the page with the piecharts visible, they are messed
> up.
> I'm not sure why... but that is what's causing it... now I just need a
> solution..
>
> Op woensdag 7 maart 2012 10:29:00 UTC+1 schreef Kasper het volgende:
>>
>> Yes, here is an example:
>> http://test.lyxdesign.nl/chart-mockup.html
>>
>> However, I've figured out why it is malfunctioning in Firefox:
>> When the first request is send, firefox does not handle the request
>> properly: it seems like it only partially loads the request.
>> Why?
>> Well, when you recieve the piechart for the first time, the labels are
>> all shown (not hidden when the area is too small for example) and not
>> placed properly.
>> And when you then refresh the page, firefox reloads (and finishes) the
>> request/piechart, and fixes the layout: hides the right labels, and places
>> them right.
>>
>> I do not know why this is though...
>> Do you have any idea?
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/urfSOlQNZFsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.