I want to set up a timeline chart like this https://apexcharts.com/javascript-chart-demos/timeline-charts/multi-series/ but instead of date as x labels only hours.
I've defined my date with timestamp
data: [
{
x: 'Maintenance',
y: [
1601361625000, // for example 2020-09-29 08:14:32
1601383225000 // for example 2020-09-29 13:25:01
]
},
{ ... }
]
And as xasis label like this
xaxis: {
type: 'datetime',
labels: {
formatter: function (value, timestamp) {
return moment(timestamp, "hh:mm");
},
}
}
But I still get the date back instead of the hours. Is this possible at all? Thx
It turns out, that the documentation is incorrect, it says this about the
formatter
function:However this is not the case, the first argument is the
timestamp
, the second is theindex
, and there isn't a third one. So actually this one will work: