So in your code that double checks the size, please also check display and
visibility css styles.
I know this because many people try to draw the graph and then fade it in
with jquery. This doesn't work. The workaround is to make it visible but
position it left:-1000 so it is off the screen to the left. Draw the graph,
then make it invisible, position it properly, then fade it in.
- George Roberts
http://gr5.org
On another note, although firefox is showing 50k points just fine, ie6 will
die with that much as <canvas> is emulated slowly in ie6. Also if you zoom
in (even with firefox) you will probably experience slow load times. If
your screen width is 50,000 pixels wide then there isn't much you can do but
if your graph is only say 1000 pixels wide then in the x direction you have
50 points per pixel. This is more data than necessary. Instead you could
do what most people do: find the min and max for 50 points on the server,
then send only the min and max values out to flot, repeat for the next 50
points and so on. This will convert 50k points to 2k points. You will get
less network traffic (slightly faster load times) and more importantly, the
graphs will come up even faster and look the same.
- George Roberts
http://gr5.org
-----Original Message-----
From: Ruben Oliveira
Sent: Tuesday, March 29, 2011 11:15 AM
To: Flot graphs
Subject: Re: uncaught exception: Invalid dimensions for plot, width = 0,
height = 0
Hi George,
> The <canvas> *must* also be visible. So even if it has a size if
> display:none or visibility:hidden is set you will get this exact same
> error.
>
> So in your code that double checks the size, please also check display and
> visibility css styles.
>
> I know this because many people try to draw the graph and then fade it in
> with jquery. This doesn't work. The workaround is to make it visible but
> position it left:-1000 so it is off the screen to the left. Draw the
> graph,
> then make it invisible, position it properly, then fade it in.
>
> - George Robertshttp://gr5.org
Not me, but apart from the good suggestions by George, I would suggest
you try calling $("#placeholder").width() and console.log it so Flot
itself doesn't enter the picture. Maybe take a small example to the
jQuery community.
About the dimensions: Once upon a time a guy here did some research on
the layout stuff so that he could hardcode the width/height with CSS,
turn the placeholder into display: none and still get a chart by
falling back to CSS values for width/height instead of real
width/height. That wouldn't work in general because Flot needs to
measure the labels too (he got around that by specifying their
dimensions manually), but now that I'm on the verge of merging in
canvas text support, I hope to see some movement here.
Ole
The "break on errors" button is found when you are in console mode the left
most icon that looks like a pause button with a red circle/slash over it.
When it is active it kind of glows. Don't forget to turn it off as it kind
of locks up all web pages where firebug is active.
- George Roberts
http://gr5.org
-----Original Message-----
From: Ruben Oliveira
Sent: Tuesday, April 05, 2011 4:31 AM
To: Flot graphs
Subject: Re: uncaught exception: Invalid dimensions for plot, width = 0,
height = 0
Firebug says that it is on jquery.js, line 1296:
return name ? jQuery.cache[ id ][ name ] : id;
This is why I associated the problem with jquery, but it may be that
the problem is elsewhere and jquery is catching it.
This error happens when I try to instantiate a new plot, while another
plot is beeing instantiated.
On 29 Mar, 16:36, "George Roberts" <gr-googlegrp...@spamarrest.com>
wrote:
> Oh. Your method looks fine. I suspect you are smarter than I gave you
> credit. I suspect you are exactly correct in that this is some strange
> jquery bug. It sucks that it is intermittent and it seems like it will be
> very difficult to debug. Noone else seems to have seen anything like this
> and I've been on this list for over a year.
>
> On another note, although firefox is showing 50k points just fine, ie6
> will
> die with that much as <canvas> is emulated slowly in ie6. Also if you
> zoom
> in (even with firefox) you will probably experience slow load times. If
> your screen width is 50,000 pixels wide then there isn't much you can do
> but
> if your graph is only say 1000 pixels wide then in the x direction you
> have
> 50 points per pixel. This is more data than necessary. Instead you could
> do what most people do: find the min and max for 50 points on the server,
> then send only the min and max values out to flot, repeat for the next 50
> points and so on. This will convert 50k points to 2k points. You will
> get
> less network traffic (slightly faster load times) and more importantly,
> the
> graphs will come up even faster and look the same.
>