我试图从Highcharts得到一个线条图。我的JSON看起来像Highcharts线条图,从JSON填充xAxis
[{"Monat":"April","d07geb":1.5},{"Monat":"June","d07geb":0.5},{"Monat":"March","d07geb":0.5},{"Monat":"May","d07geb":0.2}]
Monat意味着月,我试图得到的xAxis价值。 d07geb是该特定月份的金额。
该线条绘制完美,并且高图似乎是正确的。但是,而不是一个月,xAxis有数字值。从1月开始,下一个入口是00:00:00.001。
我对此很新颖。我设法使用饼图和柱形图。但是这个驱使我坚果
$(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);
});
});
推动我坚果的部分是,在phpmyadmin中,您可以使用higchart直接显示查询。它的作用就像一个魅力。但我无法从中解脱出来。 – user2476011