Highcharts Demo
author(s): Torstein Hønsi
by Black Label
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/boost.js"></script>
<div id="container" style="height: 400px; max-width: 800px; margin: 0 auto"></div>
<div id="heatcont" style="height: 400px; min-width: 310px; max-width: 800px; margin: 0 auto"></div>
JavaScript
function getData(n) {
var arr = [],
i,
x,
a,
b,
c,
spike;
for (
i = 0, x = Date.UTC(new Date().getUTCFullYear(), 0, 1) - n * 36e5;
i < n;
i = i + 1, x = x + 36e5
) {
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([
x,
2 * Math.sin(i / 100) + a + b + c + spike + Math.random()
]);
}
return arr;
}
var n = 500000,
data = getData(n);
Highcharts.chart('container', {
series: [{
data: data,
}]
});
Highcharts.chart('heatcont', {
series: [{
type: 'heatmap',
name: 'Sales per employee',
boostThreshold: 1,
data: [[0, 0, 10], [0, 1, 19]]
}]
});