I have Highchart LINE type graph which show line graph correctly.I have button to change the data dynamically.i.e. First chart renders 7 days data.On click of 14 days chart renders data correctly but the when i use.
function requestData(response,point){
...data fetching code......
var series = chart.series[0];
chart.series[1].setData(eval(oneArray),false,true);
chart.series[0].setData(eval(twoArray),false,true);
chart.xAxis[0].setCategories(json array, true,true);}
if i remove the chart.xAxis[0].setCategories(json array, true,true);
then it show the lines with correct data but x-axis is only numbers,I have to set x-axis with days name.The json array show all correct.
Here is my chart code.
var chart;
chart = new Highcharts.Chart({
chart: {
renderTo: "progresschart",
type: "line",
events: {
load: requestData
}
},
credits: {
enabled: false
},
title: {
text: "Calories Burned Vs Calorie Consumed"
},
xAxis: {
categories: [],
},
yAxis: {
title: {
text: "Calories"
},
},
series: [{
name: "Consumed",
data:[]
},{
name: "Burned",
data:[]
}],
exporting: {
enabled: false
}
});
});
First the category array is:
["Thu,28th", "Fri,29th", "Sat,30th", "Sun,1st", "Mon,2nd", "Tue,3rd", "Wed,4th"]
categories array to be set is:
["Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed"]
Series[1]:
[403.91604166667, 0, 0, 156.421875, 190.48708333333, 121.66145833333, 52.140625, 104.28125, 440.41447916667, 472.04645833334, 0, 178.3209375, 191.18229166666, 139.04166666667]
Series[2]:
[100, 112, 0, 0, 360, 330, 141, 150, 100, 0, 0, 0, 0, 0]