I've been attempting to generate a linear chart using highChart
, but despite multiple attempts, the chart remains blank. Here's what I've tried so far:
<script>
$(document).ready(function() {
var options={
chart: {
renderTo: 'container',
type: 'line'
},
title : {
text: 'Monthly Average Temperature'
},
subtitle : {
text: 'Source: WorldClimate.com'
},
xAxis : {
categories: ['11','jj','jj','11']
},
yAxis :{
title: {
text: 'Temperature (\xB0C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip : {
valueSuffix: '\xB0C'
},
legend : {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series : [{}]
}
$.ajax({
type: 'GET',
contentType : 'application/json',
dataType: 'JSON',
url: 'json',
data: "",
success: function(data){
var array=[] ;
$.each(data, function(i) {
array.push(data[i].id);
})
alert(array);
options.series[0]= array;
var chart = new Highcharts.Chart(options);
}
});
});
</script>
After checking with alert(array);
, it seems that an array of values is correctly returned from JSON, yet it is still not being recognized by the series
. Any assistance would be greatly appreciated.