简体   繁体   English

jQPlot图表-饼图在传递高值时消失

[英]jQPlot charts- Pie chart disappears on passing high values

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? 我得到的d1的输入值为20700000,d2的值为2300000,d3的是3040000。那么,由于值较高,图表不会出现吗?

Per your comment, you just need to refer to the d1 , d2 and d3 array values correctly. 根据您的评论,您只需要正确地引用d1d2d3数组值即可。 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) 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...

here is a working example with d1-d3 modified to arrays. 这是一个将d1-d3修改为数组的工作示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM