Hi Guys,
Please check my script :
var data = "{name:'Low Risk', y:30,color:'#62DB7D',tooltip:'Low Risk : 30%'},{name:'Medium Risk', y:50,color:'#F5A623',tooltip:'Medium Risk : 50%'},{name:'High Risk', y:20,color:'#FF6262',tooltip:'High Risk: 20%'}";
Highcharts.chart('ChartContainer', {
chart: {
type: 'pie',
spacingBottom: 5
},
credits: { enabled: false },
title:"",
tooltip: {
enabled: true,
formatter: function() {
return this.point.tooltip;
}
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
formatter: function() {
return this.point.name + ': ' + this.point.y;
}
},
showInLegend: true,
stickyTracking: false,
point: {events: {legendItemClick: function(event) {return false;}}}
}
},
legend: { floating: false,
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom'
},
series: [{name: ' ', data: ["+data+"]}]
});
Its working fine when i passed static value to data series.
series: [{name: ' ', data: [{name:'Low Risk', y:30,color:'#62DB7D',tooltip:'Low Risk : 30%'},{name:'Medium Risk', y:50,color:'#F5A623',tooltip:'Medium Risk : 50%'},{name:'High Risk', y:20,color:'#FF6262',tooltip:'High Risk: 20%'}]}]
This is script i need to pass dynamic data is series data. I am trying with above code but its fails.
please data variable initialize in first row and assign in series data which is in las row.
Also i am trying with list variable but its also failed.
So please give solution how to solve this with the above script using list variable or using JavaScript define variable.
don't really have time to look at how to do it with a parameter , but with a data variable at top of javascript, this won't work as you are creating a string variable, but it should be an array.