Highcharts Demo
author(s): Torstein Hønsi
by Sascha
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/boost.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 400px; max-width: 800px; margin: 0 auto"></div>
JavaScript
function getData(n) {
var arr = [],
i,
a,
b,
c,
spike;
for (i = 0; i < n; i = i + 1) {
if (i % 100 === 0) {
a = 2 * Math.random();
}
if (i % 1000 === 0) {
b = 2 * Math.random();
}
if (i % 10000 === 0) {
c = 2 * Math.random();
}
if (i % 50000 === 0) {
spike = 10;
} else {
spike = 0;
}
arr.push([
i,
2 * Math.sin(i / 100) + a + b + c + spike + Math.random()
]);
}
return arr;
}
var data = getData(1000);
console.time('column');
Highcharts.chart('container', {
chart: {
type: 'column',
zoomType: 'x',
panning: true,
panKey: 'shift'
},
title: {
text: 'Highcharts drawing ' + data.length + ' points'
},
plotOptions: {
boostThreshold: 500,
turboThreshold: 500,
series: {
fillOpacity: 0.4,
pointPadding: 0,
groupPadding: 0.05,
label: {
style: {
fontWeight: "normal",
},
},
dataLabels: {
style: {
fontWeight: "bold",
},
enabled: true,
},
},
},
subtitle: {
text: 'Using the Boost module'
},
tooltip: {
valueDecimals: 2
},
series: [{
data: data
}]
});
console.timeEnd('column');