2011-12-12 43 views
1

我正在使用jqplot来绘制饼图。但是,当我绘制一个包含变量100%的数据的饼图时,它会显示一个非常奇怪的饼图。饼图jqplot为100%时的正方形

enter image description here

这是我的代码

<script type="text/javascript"> 
$(document).ready(function() 
{ 

    $('#chart1').bind('jqplotDataHighlight', 
     function (ev, seriesIndex, pointIndex, data) 
     { 
      $('#info1').html('' + data[0] + " - " + data[1]); 
     } 
    ); 

    $('#chart1').bind('jqplotDataUnhighlight', 
     function (ev) { 
      $('#info1').html('&nbsp;'); 
     } 
    ); 


    var plot1 = jQuery.jqplot ('chart1', [data], 
    { 
     title: { 
      text: '', // title for the plot, 
      show: true, 
     }, 
     seriesDefaults: { 
      renderer: jQuery.jqplot.PieRenderer, 
      padding: 0, 
      color:"#FFFFFF",  
      shadow: false, 
      rendererOptions: { 
       dataLabelFormatString: "<font color=white>%d%</font>", 
       diameter: 135, 
       showDataLabels: true, 
       sliceMargin: 1, 
       textColor: "#ABBBBB", 
       lineWidth: 5 
      }, 

     }, 
     legend: { 
      show:true, location: 'e' 
     }, 

     grid: { 
      background: '#ffffff', 
      shadow: false, 
      borderWidth: 0 
     } 
    } 

); 
}); 
</script> 
+0

我认为如果你没有很好地解释,你不会得到太多的答案。通常读者认为关于这个问题的所有细节都在帖子主体本身上,并且不会试图从帖子主体的标题和其他一半中获取一半,并且理解这个问题。至少包括你用来做这件事的代码。 –

+0

“数据”数组的内容是什么? –

+0

它是工具提示,就像Android - 123设备 –

回答

0

问题是

sliceMargin:1,

没有它,一切工作正常。

0

你有

title: { 
      text: '', // title for the plot, 
      show: true, 
     }, 

两个额外的逗号和

 rendererOptions: { 
      dataLabelFormatString: "<font color=white>%d%</font>", 
      diameter: 135, 
      showDataLabels: true, 
      sliceMargin: 1, 
      textColor: "#ABBBBB", 
      lineWidth: 5 
     }, 

也就是说在JavaScript无效。所以这个问题的原因可能是这个。

+0

我更新了,但它没有解决我的问题 –