jqplot和图例选项问题

use*_*455 2 jqplot

我的代码中有以下内容.有选择权

 legend: {show:true}  
Run Code Online (Sandbox Code Playgroud)

严重扰乱图表.图例部分太长,没有图表.我在这里粘贴了图表的图像: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> 
Run Code Online (Sandbox Code Playgroud)

任何帮助赞赏.

cmc*_*nty 11

您使用的是Bootstrap还是其他一些CSS重置库?

如果你进入firebug,并选择<table class="jqplot-table-legend" ...>元素,你可能会看到有一个width:100%默认属性设置table元素.您可以在CSS布局中修复它:

#piechartdiv table.jqplot-table-legend {
    width:auto;
}
Run Code Online (Sandbox Code Playgroud)

  • 这应该被接受为OP问题的答案.我有这个问题,事实上我的CSS样式表明所有表格都有100%的宽度,这打破了传奇. (2认同)