admin管理员组文章数量:1419633
I am trying to implement high charts(pai chart) in my system where I am trying to pass the the value of data from a variable which contains the value in exact array manner that data required, alert(legend_with_values)
If I am alerting this variable it returns [['agent_total_members',24],['billing_failed',0],['members_inactive',0],['members_expired',0] ]
I am Passing this value to the data field like this
legend_with_values;
alert(legend_with_values);
this alert returns [['agent_total_members',24],['billing_failed',0],['members_inactive',0],['members_expired',0]
options.series = [{
type: 'pie',
name: 'Legend',
data: legend_with_values
}];
new Highcharts.Chart(options);`
But when I am passing this variable in data it is ing in this manner .Check the image it is taking each character as a string
and if I put the alert value statically in the data it is showing me graph properly any suggestions how to fix this ?
I am trying to implement high charts(pai chart) in my system where I am trying to pass the the value of data from a variable which contains the value in exact array manner that data required, alert(legend_with_values)
If I am alerting this variable it returns [['agent_total_members',24],['billing_failed',0],['members_inactive',0],['members_expired',0] ]
I am Passing this value to the data field like this
legend_with_values;
alert(legend_with_values);
this alert returns [['agent_total_members',24],['billing_failed',0],['members_inactive',0],['members_expired',0]
options.series = [{
type: 'pie',
name: 'Legend',
data: legend_with_values
}];
new Highcharts.Chart(options);`
But when I am passing this variable in data it is ing in this manner .Check the image it is taking each character as a string
and if I put the alert value statically in the data it is showing me graph properly any suggestions how to fix this ?
Share Improve this question edited Feb 7, 2013 at 6:46 Arihant Godha asked Feb 7, 2013 at 6:17 Arihant GodhaArihant Godha 2,4892 gold badges28 silver badges53 bronze badges1 Answer
Reset to default 3I edited your example here: http://jsfiddle/3rkd8/ and all is generated properly.
var chart,
legend_with_values = [['agent_total_members',24],['billing_failed',0],['members_inactive',0],['members_expired',0],['agent_total_members',45]];
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1
},
series: [{
type: 'pie',
name: 'Browser share',
data: legend_with_values
}]
});
});
Could you update this example if you have different source code and problem still exist?
本文标签: javascriptPass data in form of variable HighchartsStack Overflow
版权声明:本文标题:javascript - Pass data in form of variable -Highcharts - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745316418a2653173.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论