I am having issue on loading json Data from a table to highchart.js column type. I tried to load the JSON to JavaScript object and access them like : y: chartvals.projects
but I got this error message:
Uncaught Highcharts error #14: www.highcharts.com/errors/14
what I have is this ajax call and highchart snippet:
var req2 = $.ajax({
type: "POST",
data: data,
dataType: 'json',
url: "assets/tempchart.php"
});
req2.done(function(data) {
var chartvals = data;
$('#chart1').highcharts({
chart: {
type: 'column'
},
credits: {
enabled: false
},
title: {
text: 'Economy Model',
style: {
color: '#5882FA',
fontWeight: 'normal',
fontSize: '11',
marginBottom: '30'
}
},
xAxis: {
categories: ['Total Projects']
},
yAxis: {
tickInterval: 50,
max: 800
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return this.x +
' is <b>' + this.y + '</b>';
}
},
series: [{
data: [{
name: 'Point 1',
color: '#00FF00',
y: chartvals.projects
}]
}]
});
});
Can you please let me know how to fix this? Thanks
Update
Here is the Response JSON
{"project":"8","powerline":"188.396496","road":"7.876766","cost":"69885005.45"}