jqplot和图例选项问题
我的代码中有以下内容。拥有该选项
legend: {show:true}
会严重扰乱图表。图例部分好长 并且没有图表。 我已将图表的外观图像粘贴到此处: http://tinypic.com/view.php?pic=2eqgbgy&s=7
虽然没有图例选项,它显示得很好,但图表当然没有图例。
在 Chrome 中我看到以下异常 未捕获的错误:INDEX_SIZE_ERR:DOM 异常 1
<script type="text/javascript">
line2 = [['Living Expenses',1000], ['Loans',2000], ['Credit
Card',500]];
$j(document).ready(function() {
$j.jqplot.config.enablePlugins = true;
$j.jqplot('piechartdiv', [line2], {
title: 'Where is my money going?',
seriesDefaults:{renderer:$j.jqplot.PieRenderer,
rendererOptions:{sliceMargin:8}}, legend:{show:true}
});
});
</script>
<div style="width: 450px;margin: 0px auto;">
<div id='piechartdiv'></div>
</div>
感谢任何帮助。
I have the following in my code. Having the option
legend: {show:true}
messes up the chart badly. The legend section is so long
and there is no chart.
I have pasted the image here of how the chart looks :
http://tinypic.com/view.php?pic=2eqgbgy&s=7
It shows fine without the legend option though, but chart is of course without the legend.
In Chrome I see the following exception
Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1
<script type="text/javascript">
line2 = [['Living Expenses',1000], ['Loans',2000], ['Credit
Card',500]];
$j(document).ready(function() {
$j.jqplot.config.enablePlugins = true;
$j.jqplot('piechartdiv', [line2], {
title: 'Where is my money going?',
seriesDefaults:{renderer:$j.jqplot.PieRenderer,
rendererOptions:{sliceMargin:8}}, legend:{show:true}
});
});
</script>
<div style="width: 450px;margin: 0px auto;">
<div id='piechartdiv'></div>
</div>
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否使用 Bootstrap 或其他 CSS 重置库?
如果您进入 firebug,并选择
元素,您可能会看到有一个
width:100 %
默认属性设置table
元素。您可以在 CSS 布局中修复它:Are you using Bootstrap or some other CSS reset library?
If you go into firebug, and select the
<table class="jqplot-table-legend" ...>
element, you'll probably see that there is awidth:100%
default property set thetable
elements. You can fix it in your CSS layout:对我来说唯一奇怪的是:
为什么你的代码上有一些J?除此之外,一切似乎都很好,也许尝试在图例上放置一个位置,看看是否解决这个问题,这是一个例子:
The only thing that seems weird to me is this:
Why are there some J's on your code?, besides that, everything seems to be fine, maybe try putting a location on the legend to see if that fix the issue, here is an example:
我遇到过类似的事情。
尝试检查 css 属性 text-align:left
恐怕我不知道为什么,但这些为我修复了错误
I came across something similar.
try checking css property text-align:left
I'm afraid I don't know why but these fixed the error for me
您是否在代码中包含了 jqplot.css 文件?
确保它包含在代码中,并且该文件也存在于您引用的目录中。
谢谢
Have you included the jqplot.css file in your code.
Make sure that it is included in the code, and that the file is also present in the directory you are referring to.
Thank you