First of all, there is a similar question here and I also read GitHub issues related to xFormat & timestamp (i.e. here). None of these solved my problem.
From D3 Time Format :
%Q - milliseconds since UNIX epoch.
%s - seconds since UNIX epoch.
When using xFormat: '%Q'
and timestamp in milliseconds (i.e. 1524362421000), it is working.
But when using xFormat: '%s'
and timestamp in seconds (i.e. 1524362421) all tick marks along x-axis showing wrong date: 1970-01-18
)
axis: {
x: {
type: 'timeseries',
tick: {
fit: true,
format: "%Y-%m-%d",
rotate: 45
}
}
The JSON response from API uses timestamp in seconds and I can not change it to milliseconds (I know JS uses milliseconds to parse date). Therefore, I need xFormat: '%s'
to work.