d3 / d3-scale

Encodings that map abstract data to visual representation.
https://d3js.org/d3-scale
ISC License
1.59k stars 286 forks source link

Time Scale: How could one provide a custom irregular spacing of ticks? #262

Closed DerGuteWolf closed 2 years ago

DerGuteWolf commented 2 years ago

As weekends are less interesting in one of our use cases, we are looking for a way to a have a time scale (and axis) in which the weekend hours are spaced more densly then the workday hours. How could the be achieved? Since there is alreay support for "irregular spacing of ticks because time intervals have varying length" this should somehow be possible, or?

Fil commented 2 years ago

This candlestick chart follows a similar requirement, by removing the week-ends. However note that it's an ordinal chart (day by day), not continuous time.

If you want to make time continuous but non-linear you can certainly write your own function from the time domain to floats, and then put back the correct ticks on the axis. I'm doing that (although with a different time warper) in this renko chart notebook.

I'm closing the issue since this is not a bug or a thing we'd want to develop inside of d3-scale, but happy to continue the discussion.