dynamic area
by jayhilwig
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
var chart;
var lastdate = 1343387830000;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'area',
animation: false,
animation: Highcharts.svg, // don't animate in old IE
marginRight: 10,
backgroundColor: '#000000',
borderRadius: 0,
marginTop: 20,
events: {
load: function () {
// set up the updating of the chart each second
var serieslist = this.series;
setInterval(function () {
lastdate = lastdate + 10000
for (seriesidx in serieslist) {
var x = lastdate, // current time
y = this.value;
serieslist[seriesidx].addPoint([x, y], true, true);
}
}, 2000);
}
}
},
credits: {
enabled: false
},
title: {
text: null
},
xAxis: {
type: 'datetime',
tickPixelInterval: 500,
labels: {
align: 'center',
x: 0,
y: 22,
formatter: function () {
return Highcharts.dateFormat('%l:%M:%S', this.value);
}
},
},
yAxis: {
title: {
margin: 30,
text: '% Compressed',
style: {
color: '#ffffff',
}
},
max: 100,
labels: {
min: 0,
...