JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 40,
},
plotOptions: {
series: {
events: {
click: function (event) {
var str = event.point.series.yAxis.categories[event.point.y] + ',' +
event.point.series.xAxis.categories[event.point.x]
alert(str);
}
}
}
},
title: {
text: 'Sales per employee per weekday'
},
xAxis: {
categories: ['Alexander', 'Marie', 'Maximilian', 'Sophia', 'Lukas', 'Maria', 'Leon', 'Anna', 'Tim', 'Laura']
},
yAxis: {
categories: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
title: null
},
colorAxis: {
min: -1,
max: 1,
tickInterval: 0.5,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
legend: {
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 320
},
tooltip: {
formatter: function () {
return '<b>' + this.series.xAxis.categories[this.point.x] + '</b> sold <br><b>' + this.point.value + '</b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '</b>';
}
},
series: [{
name: 'Sales per employee',
borderWidth: 1,
data: [
[0, 0, 0.10],
[0, 1, -0.19],
[0, 2, 0.8],
[0, 3, -0.24],
[0, 4, 0.67],
[1, 0, 0.92],
[1, 1, -0.58],
[1, 2, 0.78],
[1, 3, -0.117],
[1, 4,...