하이 차트가 업데이트되면 브라우저가 자동으로 페이지 업된다는 성가신 문제를 발견했습니다. 솔루션 (Check this link)을 이미 검색하고 있으며 그 원인은 new chart
을 호출하는 것이지만 내 코드에서는이를 사용하지 않는다고 설명합니다.데이터가 업데이트 될 때 Highchart 자동 페이지 업 브라우저 사용
HTML 코드
<div class="gp_power">
<div id="graph_power"></div>
</div>
JS 코드
$(document).ready(function(){
\t function read(){
\t \t $.post("graph_power.php",
\t \t function(data, status){
\t \t if(status == 'success'){
cur_date = (data.cur_date.join(','));
pow_dat_0000 = Number(data.pow_dat_0000.join(','));
graph_power(cur_date, pow_dat_0000);
\t \t }
\t \t });
\t };
\t read();
setInterval(function() {
if(new Date().getMinutes() % 1 == 0){
if(new Date().getSeconds() == 0){
read();
}
}
}, 100)
function graph_power(cur_date, pow_dat_0000) {
$('#graph_power').highcharts({
chart: {
type: 'column',
margin: [ 50, 50, 100, 80]
},
plotOptions: {
column: {
colorByPoint: true
}
},
colors: [
'#e74c3c',
'#3498db',
],
title: {
text: 'Power Consumption of Today ' +'[ '+ '<b>' + cur_date + '</b>' + ' ]'
},
xAxis: {
categories: ['00:00','00:30'],
labels: {
rotation: -45,
align: 'right',
style: {
fontSize: '9px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: 'Power (watt)'
}
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
'Power: '+ Highcharts.numberFormat(this.y, 1) +
' watt';
}
},
series: [{
name: 'Watts',
data: [pow_dat_0000, pow_dat_0030],
dataLabels: {
enabled: true,
rotation: -90,
color: '#FFFFFF',
align: 'right',
x: 4,
y: 10,
style: {
fontSize: '0px',
fontFamily: 'Verdana, sans-serif'
}
}
}]
});
};
});
날이 문제를 해결 도와주세요. 고맙습니다.
당신은 종류의 새로운 사용 : 나는 당신이 당신의 데이터를 업데이트하는 방법을 보여주는 예제를 만들어 플러그인. http://code.highcharts.com/highcharts.src.js – stpoa