Flot pie chart gives error in firebug: "uncaught exception: Invalid dimensions for plot, width = null, height = null"

user1662343 picture user1662343 · Sep 11, 2012 · Viewed 51k times · Source

I using flot pie chart for plotting pie charts. but it shows error in firebug that

uncaught exception: Invalid dimensions for plot, width = null, height = null

I have given the height and width from stylesheet also. and tried also like this

<div id="placeholder1" style="width:140px;height:140px" ></div>

how to resolve this?

Answer

thecodeparadox picture thecodeparadox · Sep 11, 2012

Check these:

  • You include the jQuery library first and then flot js library

  • Wrap the whole code within $(document).ready() handler function.

  • you bind the flot with correct id and there is no repeat of same id.

  • if your div is dynamic i.e. appeared to DOM after page load then bind plot() after the element appeared to DOM.