2017-11-05 2 views
-1

하이 차트를 사용하여 mySQL의 데이터를 표시하지만 일부 데이터 만 인쇄 할 수 있습니다. 나는 이것이 setExtremes를 사용해야하기 때문에 이것이라는 것을 알았다. 누군가 내게 모든 데이터를 dispplay 내 코드 ijn 순서를 변경할 수 있도록 나를 도울 수 있습니까? 도움이 될 것입니다. 1000 개가 넘는 mySQL 포인트가있는 하이 차트

내 작업 코드

(만 보여줍니다 일부 데이터) :

<!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> 

내가 datatemphumi.php에서 얻을 : 내가 달성하고자하는 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

안녕하세요, 극한을 사용하여 서로 다른 간격을 가진 다른 카테고리를 표시하는 방법에 대한 예를 보내주십시오. 나는 당신의 예와 같이 하나의 차트에 표시해야합니다 ... 하지만 각 카테고리에 대해 다른 시간 기록표에 포인트를 표시해야합니다 (값이 각 카테고리에 대해 동시에 기록되지 않으므로) 내 데이터 테이블. PHP 제공 : https://pastebin.com/CcMMuuVV 내 코드 : https://pastebin.com/KR9Gbxfj 하지만 예상대로 작동하지 않습니다. 이 예제에서와 같이 포인트를 표시 할 수 있어야합니다. https://pasteboard.co/GT8vM8I.png – NaThAN

관련 문제