我的代码中有以下内容。有选择权
legend: {show:true}
把图表搞得一团糟。图例部分好长 而且没有图表。 我在此处粘贴了图表外观的图片: http://tinypic.com/view.php?pic=2eqgbgy&s=7
尽管没有图例选项也能正常显示,但图表当然没有图例。
在 Chrome 中我看到以下异常 Uncaught Error :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>
感谢任何帮助。
最佳答案
你在使用 Bootstrap还是其他一些 CSS 重置库?
如果您进入 Firebug ,并选择 <table class="jqplot-table-legend" ...>
元素,你可能会看到有一个 width:100%
默认属性设置 table
元素。您可以在 CSS 布局中修复它:
#piechartdiv table.jqplot-table-legend {
width:auto;
}
关于jqplot 和图例选项问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4181427/