Invalid dimensions for plot, width = 0, height = 0

617 views
Skip to first unread message

Prashant Pokhriyal

unread,
Feb 15, 2018, 10:14:50 AM2/15/18
to Flot graphs
I recently updated my jquery from 3.2.1 to 3.3.1. Confoundedly now flot chart is not working it's throwing following error in console. I'm giving width and height in percentage. 
I changed it to pixel (px), then it's working properly but I want this with width and height as percentage. Please help me out.

Error: Invalid dimensions for plot, width = 0, height = 0
    at Canvas.resize (jquery.flot.js:137)
    at new Canvas (jquery.flot.js:116)
    at setupCanvases (jquery.flot.js:1316)
    at new Plot (jquery.flot.js:709)
    at Function.$.plot (jquery.flot.js:3151) 

Martin Bellwood

unread,
Jun 13, 2018, 10:23:47 AM6/13/18
to Flot graphs
I had exactly the same issue on updating to jQuery 3.3.1

My fix was to dynamically set the chart div to the pixel width of  its container div:

     $(".ChartDiv").width(  $(".CharcontainerDiv").width()  )

before drawing the chart.

Not very elegant but it worked...

M
Reply all
Reply to author
Forward
0 new messages