2017-11-05 6 views
-1

私はハイチャートを使用してmySQLのデータを表示していますが、データは一部しか印刷できません。私はsetExtremesを使う必要があるので、これがわかった。誰かが私のコードを変更してすべてのデータを解読できるように助けてもらえますか? ご協力いただければ幸いです!1000以上のmySQLポイントを持つハイチャート

私の作業コードは(ただし、一部のデータのみを表示):私はdatatemphumi.phpから何を得る

<!DOCTYPE HTML> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 
<meta http-equiv="refresh" content="150"> 
<title>Fukt/Temp/Tryck</title> 
<script type="text/javascript" src="includes/js/jquery-3.2.1.min.js"> 
</script> 
<script type="text/javascript"> 
$(document).ready(function() { 
var options = { 
chart: { 
zoomType: 'xy', 
alignTicks: false, 
renderTo: 'container', 
type: 'line', 
marginRight: 80, 
marginBottom: 55 
}, 
title: { 
text: 'Temp och Fukt', 
x: -20 //center 
}, 
xAxis: { 
crosshair: true, 
type: 'datetime', 
tickInterval: 80, 
labels: { 
format: '{value: %H:%M}', 
dateTimeLabelFormats: { 
day: '%H:%M' 
} 
} 
}, 
yAxis: [{ 
title: { 
tickInterval: 0.1, 
text: '°C/%', 
rotation: 0, 
}, 
labels: { 
overflow: 'justify' 
} 
}, 
{ 
title: { 
tickInterval: 0.1, 
text: '°C/%', 
rotation: 0, 
}, 
linkedTo:0, 
opposite:true 
}], 
tooltip: { 
shared: true 
}, 
legend: { 
enabled: true, 
layout: 'horizontal', 
align: 'center', 
verticalAlign: 'bottom', 
borderWidth: 0 
}, 
series: [] 
} 
$.getJSON("datatemphumi.php", function(json) { 
options.xAxis.categories = json[3]['data']; 
options.series[0] = json[1]; 
options.series[1] = json[2]; 
chart = new Highcharts.Chart(options); 
}); 
}); 
</script> 
<script src="https://code.highcharts.com/highcharts.js"></script> 
<script src="https://code.highcharts.com/modules/exporting.js"></script> 
</head> 
<body> 
<div id="container" style="min-width: 400px; height: 400px; margin: 0 
auto"></div> 
</body> 
</html> 

https://pastebin.com/bunAhzXV

そして、私は達成したいサンプルコード:https://www.highcharts.com/blog/news/48-loading-millions-of-points-in-highcharts/

+2

を使用して、あなたが実際にあなたが提供されたデータに問題がありますか?私はあなたのチャートオプションhttps://jsfiddle.net/peterlgh7/46nf7rq5/でこのフィドルを作ったし、それは私にはすべてのデータがあるように思える。 – Pedro

答えて

0

私がチェックしたところから、実際のポイントよりも多くのカテゴリがあります。あなたが強制しない限り、ポイントのないカテゴリは表示されません。たとえば、maxプロパティを使用するか、以前にあなたが指摘したsetExtremes機能を使用できます。

APIリファレンス:
https://api.highcharts.com/highcharts/xAxis.max
https://api.highcharts.com/class-reference/Highcharts.Axis.html#setExtremes

例:
http://jsfiddle.net/nzoy4sqe/からmax

+0

こんにちは、私は、極端なセットを使用して異なる間隔を持つ異なるカテゴリを表示する方法の例を私に送ることができますか?私はあなたの例のように1つのチャートに表示する必要があります... しかし、私は各カテゴリの異なるタイムスタンプのポイントを表示する必要があります(値は各カテゴリーごとに同時に書かれていないので) 私のdatatemphumiです。 phpはhttps://pastebin.com/CcMMufVG です。私のコードはhttps://pastebin.com/KR9Gbxfj ですが、期待通りに動作しません。この例のようなポイントを表示する必要があります:https://pasteboard.co/GT8vM8I.png – NaThAN

関連する問題