Answer to Stack Overflow question: http://stackoverflow.com/questions/37851990/populating-highchart-line-with-array-of-objects
Mike Zavarello
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
// draw chart
$('#container').highcharts({
chart: {
type: 'line'
},
title: {
text: 'Year Wise Sales Data'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr']
},
yAxis: {
title: {
text: 'Sold Value'
},
labels: {
formatter: function () {
return this.value + '';
}
}
},
plotOptions: {
line: {
dataLabels: {
enabled: false
},
enableMouseTracking: true
}
},
//series: response
series: [
{"name":"2012","data":[
{
"date": 1535587200000,
"volume": 1144685729.4556425
},
{
"date": 1535500800000,
"volume": 1282728576.0921612
},
{
"date": 1530230400000,
"volume": 1057698480.8145105
},
{
"date": 1535414400000,
"volume": 1409909526.654667
}]}
]
});
});