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

后端 未结 7 1455
盖世英雄少女心
盖世英雄少女心 2020-12-29 04:14

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

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

7条回答
  •  猫巷女王i
    2020-12-29 04:52

    I had the same problem integrating template to rails. That's a bad way, but I just comment the line which throws the exception and add 2 lines to set width and height to 0 - it helped me.

    Canvas.prototype.resize = function(width, height) {
    
      if (width <= 0 || height <= 0) {
        // COMMENTED NEXT LINE
        // throw new Error("Invalid dimensions for plot, width = " + width + ", height = " + height);
        // NEW LINES ADDED
        width = 0;
        height = 0;
      }
    
      // ... others code 
    }
    

提交回复
热议问题