jQPlot图表

编程入门 行业动态 更新时间:2024-10-24 11:23:06
jQPlot图表 - 饼图在传递高值时消失(jQPlot charts- Pie chart disappears on passing high values)

当我运行代码时,图表消失

$(document).ready(function(){ var d1=${views}; var d2=${comoneviews}; var d3=${comtwoviews}; var plot1 = $.jqplot('piechart', [[['Your Organisation',d1],['Competitor#1',d2],['Competitor#2',d3]]], { gridPadding: {top:0, bottom:38, left:0, right:0}, seriesDefaults:{ renderer:$.jqplot.PieRenderer, trendline:{ show:false }, rendererOptions: { padding: 7, showDataLabels: true , dataLabels: 'value'} }, legend:{ show:true, placement: 'outside', rendererOptions: { numberRows: 1 }, location:'s', marginTop: '15px' } }); });

我得到的输入值为d1是20700000,d2是2300000,而d3是3040000.因此,图表不会出现,因为更高的值?

When i run the code the chart disappears

$(document).ready(function(){ var d1=${views}; var d2=${comoneviews}; var d3=${comtwoviews}; var plot1 = $.jqplot('piechart', [[['Your Organisation',d1],['Competitor#1',d2],['Competitor#2',d3]]], { gridPadding: {top:0, bottom:38, left:0, right:0}, seriesDefaults:{ renderer:$.jqplot.PieRenderer, trendline:{ show:false }, rendererOptions: { padding: 7, showDataLabels: true , dataLabels: 'value'} }, legend:{ show:true, placement: 'outside', rendererOptions: { numberRows: 1 }, location:'s', marginTop: '15px' } }); });

the input values i am getting for d1 is 20700000 , d2 is 2300000, and d3 is 3040000. So does the chart does not appear because of higher values?

最满意答案

根据您的评论,您只需要正确引用d1d2d3数组值即可。 正如您所提到的,您将它们作为数组获取 - 因此问题必须在于您对实际值的访问。

访问它们为d1[0] d2[0] d3[0] (假设你有一个像你写的一个大小的数组)

var d1=[20700000]; var d2=[2300000]; var d3=[3040000]; var plot1 = $.jqplot('piechart', [[['Your Organisation',d1[0]], ['Competitor#1',d2[0]],['Competitor#2',d3[0]]]], { ...rest of plot code...

这里是将d1-d3修改为数组的一个工作示例 。

Per your comment, you just need to refer to the d1,d2 and d3 array values correctly. As you've mentioned, you are getting them as arrays - so the problem must be with your access to the actual values.

Access them as d1[0] d2[0] d3[0] (assuming you have a one sized array like you wrote)

var d1=[20700000]; var d2=[2300000]; var d3=[3040000]; var plot1 = $.jqplot('piechart', [[['Your Organisation',d1[0]], ['Competitor#1',d2[0]],['Competitor#2',d3[0]]]], { ...rest of plot code...

here is a working example with d1-d3 modified to arrays.

更多推荐

本文发布于:2023-08-04 11:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1414085.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图表   jQPlot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!