Microseconds are not supported?
manake opened this issue · comments
I have a fully working linear scale where each integer is supposed to be a millisecond:
let x = d3.scaleLinear().domain([left, right]).range([0, width]);
scale-1.mp4
I switch this to a time scale and the x axis stops working (I assume because microseconds are not supported in d3.js and it modifies the domain to snap it to the nearest millisecond):
let x = d3.scaleUtc().domain([left, right]).range([0, width]);
scale-2.mp4
How can I fix this?
JavaScript Date objects only have millisecond resolution so you’ll have to use a linear scale instead if you want microseconds.
Thank you, I will try adding a custom display formatter.
But I also think it's an inconsistency because scaleLinear()
is linearly interpolated and scaleUtc()
could be too in such case.
Currently it seems to modify the domain and with linear interpolation it wouldn't, which would be better.
There are some rumors that a Temporal
replacement for Date
could appear, can't wait: