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

后端 未结 7 1423
盖世英雄少女心
盖世英雄少女心 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
    慢半拍i (楼主)
    2020-12-29 04:50

    So, it seems that before you render to a chart, you need to re-fetch the DOM element. Since flot manipulates the elements and inserts its own, it looks like it's replacing the element with its own elements.

    In your render, do:

    $.plot($(".myChartId || #myChartClass"), myData, myOptions);
    

    This has nothing to do with being in $(document).ready(), although it is good practice to place it inside of this.

    Hope this helps!

提交回复
热议问题