Javascript 当pie jqplot为100%时为正方形
我正在使用jqplot绘制饼图。但当我用代表变量100%的数据绘制饼图时,它显示了一个非常奇怪的饼图 这是我的密码Javascript 当pie jqplot为100%时为正方形,javascript,jqplot,Javascript,Jqplot,我正在使用jqplot绘制饼图。但当我用代表变量100%的数据绘制饼图时,它显示了一个非常奇怪的饼图 这是我的密码 <script type="text/javascript"> $(document).ready(function() { $('#chart1').bind('jqplotDataHighlight', function (ev, seriesIndex, pointIndex, data) {
<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(' ');
}
);
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>
$(文档).ready(函数()
{
$('#chart1').bind('jqplotDataHighlight',
函数(ev、序列索引、点索引、数据)
{
$('#info1').html(''+data[0]+'-'+data[1]);
}
);
$('#chart1').bind('jqplotDataUnhighlight',
功能(ev){
$('#info1').html('');
}
);
var plot1=jQuery.jqplot('chart1',[data],
{
标题:{
文本:“”,//绘图的标题,
秀:没错,
},
系列默认值:{
渲染器:jQuery.jqplot.pierender,
填充:0,
颜色:“FFFFFF”,
影子:错,
渲染器选项:{
dataLabelFormatString:“%d%”,
直径:135,
showDataLabels:正确,
利润率:1,
textColor:“abbbb”,
线宽:5
},
},
图例:{
显示:正确,位置:'e'
},
网格:{
背景:“#ffffff”,
影子:错,
边框宽度: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
},
渲染器选项:{
dataLabelFormatString:“%d%”,
直径:135,
showDataLabels:正确,
利润率:1,
textColor:“abbbb”,
线宽:5
},
这在javascript中是无效的。因此,出现此问题的原因可能是这样。问题是
利润率:1
没有它,一切都正常。如果你没有解释清楚,我想你不会得到太多答案。通常情况下,读者会认为问题的所有细节都在文章正文中,不会试图从标题中取一半,从文章正文中取另一半来理解问题。至少包括您用于此操作的代码。“数据”数组的内容是什么?它是工具提示,如Android-123设备。我想知道此行中变量的值。“jQuery.jqplot('chart1',[data]”我认为这不是一个工具提示。请参阅文档:并检查下面附加的逗号问题是否是原因。这是数据--data=[['Android',3]];