当我运行代码时,图表消失
$(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?
最满意答案
根据您的评论,您只需要正确引用d1 , d2和d3数组值即可。 正如您所提到的,您将它们作为数组获取 - 因此问题必须在于您对实际值的访问。
访问它们为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.
更多推荐
发布评论