0
我想要獲取高分區圖表從Mysql獲取數據。在highcharts網站上提供的示例是從csv文件調用數據。我如何從MySQL服務器調用這些數據?此particuar樣品鏈接:DEMO從Highstock區域圖獲取Mysql數據。
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
$('#container').highcharts('StockChart', {
rangeSelector : {
inputEnabled: $('#container').width() > 480,
selected : 1
},
title : {
text : 'AAPL Stock Price'
},
series : [{
name : 'AAPL Stock Price',
data : data,
type : 'areaspline',
threshold : null,
tooltip : {
valueDecimals : 2
},
fillColor : {
linearGradient : {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops : [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
}
}]
});
});
});
您可以從** ** mysql的表中使用PHP ** **,然後用它在上面的代碼,** ** JSON數據的形式,如果共享你的表結構得到的數據我可以幫助你的代碼。 –
好的非常感謝〜我正在使用mysql作爲我的數據庫,其中我的數據庫的名稱是'my database_dl',表名是fuel_level,使用的字段是'date'(yy-mm-dd)和'hours' (編號:例如:23)。 – user3721177
等x軸上你想要日期(yy-mm-dd)和y軸上你想要幾小時(只有幾小時)? –