Flot 饼图在萤火虫中给出错误:“未捕获的异常:绘图尺寸无效,宽度 = 空,高度 = 空"; [英] Flot pie chart gives error in firebug: "uncaught exception: Invalid dimensions for plot, width = null, height = null"

查看:19
本文介绍了Flot 饼图在萤火虫中给出错误:“未捕获的异常:绘图尺寸无效,宽度 = 空,高度 = 空";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 flot 饼图来绘制饼图.但它在萤火虫中显示错误

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>

如何解决这个问题?

推荐答案

检查这些:

  • 您先包含 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()元素出现在 DOM 中.

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

这篇关于Flot 饼图在萤火虫中给出错误:“未捕获的异常:绘图尺寸无效,宽度 = 空,高度 = 空";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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