var hour = 60 * 60 * 1000;
var chart = Highcharts.chart('container', {
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 80,
plotBorderWidth: 1
},
title: {
text: 'Test pointPlacement in heatmap with datetime axis'
},
xAxis: {
type: "datetime"
},
yAxis: {
categories: ['Cat 0', 'Cat 1'],
title: null
},
colorAxis: {
min: 0,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
legend: {
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 280
},
tooltip: {
formatter: function() {
return '<b>' + '</b> Color Axis: <b>' +
this.point.value + '</b><br> y-Axis: <b>' + this.series.yAxis.categories[this.point.y] + '</b>';
}
},
series: [{
name: 'hourly values of category',
colsize: hour,
pointRange: hour,
borderWidth: 1,
data: [
[hour, 0, 1],
[2 * hour, 0, 2],
[hour, 1, 3],
[2 * hour, 1, 4]
],
dataLabels: {
enabled: true,
color: '#000000'
}
}]
});
function placement(option) {
chart.setTitle({
text: "Placement Option: " + String(option)
})
chart.series[0].update({
pointPlacement: option
}, true);
}
<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>
<div id="container" style="height: 400px; min-width: 310px; max-width: 800px; margin: 0 auto"></div>
<button onclick='placement(null);'>
null
</button>
<button onclick='placement("on");'>
on
</button>
<button onclick='placement("between");'>
between
</button>
<button onclick='placement(-0.5);'>
-0.5
</button>
<button onclick='placement(0.5);'>
0.5
</button>