Flot饼图在firebug中给出错误:“未捕获异常:绘图的无效维度,width = null,height = null” [英] Flot pie chart gives error in firebug: "uncaught exception: Invalid dimensions for plot, width = null, height = null"

查看:2237
本文介绍了Flot饼图在firebug中给出错误:“未捕获异常:绘图的无效维度,width = null,height = null”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 flot 饼图绘制饼图。但它在firebug中显示错误

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


未捕获异常:plot的宽度无效,width = null,height
= null


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 =placeholder1style =width:140px; height:140px>

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

推荐答案

请检查这些:


  • 先包括jQuery库,然后是flot js库

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

将整个代码包含在 $(document).ready()处理函数中。

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

您将正确的 id 绑定到flot,并且没有重复相同 id

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

如果您的 div 是动态的,即在网页加载后显示为DOM,然后绑定 plot() after
元素出现在DOM中。

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

这篇关于Flot饼图在firebug中给出错误:“未捕获异常:绘图的无效维度,width = null,height = null”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆