hightchart [하이차트] 이번에는 hightchat 를 하게 됐음-리얼타임 샘플
이번에는 hightchat 를 하게 되었음...ㅠ,.ㅠ 리얼타임 시리즈 3개 샘플
나름 이쁘넹.
스크립트 시작 -------------------
$(function () {
$(document).ready(function() {
Highcharts.setOptions({
global: {
useUTC: false
}
});
var chart;
$('#container').highcharts({
chart: {
type: 'spline',
animation: Highcharts.svg, // don't animate in old IE
marginRight: 10,
events: {
load: function() {
// set up the updating of the chart each second
var series = this.series[0];
var series2 = this.series[1];
var series3 = this.series[2];
setInterval(function() {
var x = (new Date()).getTime(), // current time
y = Math.random();
z = Math.random();
a = Math.random();
series.addPoint([x, y], false, true);
series2.addPoint([x,z], false, true);
series3.addPoint([x,a], true, true);
}, 1000);
}
}
},
title: {
text: '샘플그래프'
},
subtitle: {
text: '서브타이틀'
},
xAxis: {
title:{
text:'X 값' /*X 축 라벨*/
},
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {
title: {
text: 'Y 값' /*y축 라벨*/
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: false
},
exporting: {
enabled: false
},
series: [{
name: '툴팁라벨1',
data: (function() {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
for (i = -19; i <= 0; i++) {
data.push({
x: time + i * 1000,
y: Math.random()
});
}
return data;
})()
},
{
name: '툴팁라벨2',
data: (function() {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
a;
for (a = -19; a <= 0; a++) {
data.push({
x: time + a * 1000,
y: Math.random()
});
}
return data;
})()
},
{
name: '툴팁라벨3',
data: (function() {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
a;
for (a = -19; a <= 0; a++) {
data.push({
x: time + a * 1000,
y: Math.random()
});
}
return data;
})()
}
]
});
});
});
스크립트 끝 ---------------------
결과물
+ 디폴트 디자인대신에 gray theme 을 사용