I'm trying to get a line graph from Highcharts. My JSON looks like
[{"Monat":"April","d07geb":1.5},{"Monat":"June","d07geb":0.5},{"Monat":"March","d07geb":0.5},{"Monat":"May","d07geb":0.2}]
Monat means month, the value i'm trying to get on the xAxis. d07geb is the amount of money for that specific month.
The line draws perfect and the highchart seems to be correct. But instead of month, the xAxis has numeric values. Starting with 1. Jan and the next entry is 00:00:00.001.
I'm very new at this. I've managed to use pie and column charts. But this one drives me nuts
$(function () {
var chart;
var myJson =
[{"Monat":"April","d07geb":1.5},{"Monat":"June","d07geb":0.5},{"Monat":"March","d07geb":0.5},{"Monat":"May","d07geb":0.2}]
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Money per Month'
},
xAxis: {
type: 'datetime'},
tooltip: {
formatter: function() {
return '<b>'+ this.point.name;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>'+ this.point.name;
}
}
}
},
series: []
};
var seriesNew = {
type: 'line',
name: 'value',
data: []
};
jQuery.each(myJson, function (itemNo, item) {
seriesNew.data.push([
item.Monat,
item.d07geb
])
});
options.series.push(seriesNew);
chart = new Highcharts.Chart(options);
});
});