label format in tooltip and datagrouping
Datagrouping let you format dates, but when zoomed in enough, the raw date has no format (see tooltip)
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
JavaScript
//create timedata
var data = [];
var m = Date.UTC(2016);
var until = Date.now();
while (m < until) {
data.push({
x: m,
y: Math.floor(Math.random() * 1000)
});
m += 15 * 60 * 1000;
}
Highcharts.chart('container', {
chart: {
type: 'column',
zoomType: 'x'
},
tooltip: {
//headerFormat: "<span style='font-size: 10px'>{point.key}</span><br/>"
//formatter: function() {
// console.log(this);
//}
},
navigator: {
enabled: true,
height: 80,
xAxis: {
id: 'navAs',
labels: {
y: 10
}
}
},
plotOptions: {
series: {
type: 'column',
turboThreshold: 0,
dataGrouping: {
enabled: true,
}
},
column: {
groupPadding: 0,
pointPadding: 0,
borderWidth: 1,
crisp: true
}
},
xAxis: {
type: 'datetime',
minRange: 6 * 3600 * 1000 // 6 hours
},
yAxis: [{
title: {
text: 'kWh'
}
}, {
title: {
text: 'm3'
},
opposite: true
}],
series: [{
name: "Random",
type: 'column',
showInNavigator: true,
yAxis: 0,
data: data
}]
});