I put time (timestamp) on xSerie and the hours on ySeries hours.
This is my code:
Code: Select all
var currDate = new Date(myTIMESTAMP);
twodayAgo.setDate(currDate.getDate() -2);
onedayAfter.setDate(currDate.getDate());
Highcharts.chart(chartUnit, {
chart: {
type: 'heatmap',
margin: [60, 10, 80, 50]
},
boost: {
useGPUTranslations: true
},
title: {
text: ' ',
align: 'left',
x: 40
},
xAxis: {
type: 'datetime',
min: Date.UTC(twodayAgo.getFullYear(),twodayAgo.getMonth(),twodayAgo.getDate(),twodayAgo.getHours(),twodayAgo.getMinutes(),twodayAgo.getSeconds()),
max: Date.UTC(onedayAfter.getFullYear(),onedayAfter.getMonth(),onedayAfter.getDate(),onedayAfter.getHours(),onedayAfter.getMinutes(),onedayAfter.getSeconds()),
labels: {
align: 'left',
x: 5,
y: 14,
format: '{value:%Y-%m-%d}'
},
showLastLabel: false,
tickLength: 5
},
yAxis: {
title: {
text: null
},
labels: {
format: '{value}:00'
},
minPadding: 0,
maxPadding: 0,
startOnTick: false,
endOnTick: false,
tickPositions: [0,6,12,18,24],
tickWidth: 1,
min: 0,
max: 23,
reversed: true
},
colorAxis: {
stops: [
[0, '#3060cf'],
[0.5, '#fffbbc'],
[0.9, '#c4463a'],
[1, '#c4463a']
],
min: 0,
max: 1000,
startOnTick: false,
endOnTick: false,
labels: {
format: '{value}'
}
},
series: [{
boostThreshold: 100,
borderWidth: 0,
nullColor: '#EFEFEF',
colsize: 24 * 3600 * 1000,//colsize: 24 * 36e5, // one day
tooltip: {
headerFormat: '',
pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ?</b>'
},
turboThreshold: Number.MAX_VALUE // #3404, remove after 4.0.5 release,
}
]
});
Using Javascript from timestamp have 2 values with milleseconds (day and hours) and created the array that use to fill the heatmap: But the heatmap that I have (wrong) is this: it's as if I'm wrong to create the hours from timestamo because it puts the values only at zero.
Where am I wrong? How do I create a correct heatmap with my values?