d3-axis
d3-axis copied to clipboard
Configuration
Here's a proposal for #64
title
axis.title([title]) sets a title, which creates a text element towards the tip of the axis.
- The precise positioning is not as beautiful as in the https://observablehq.com/@d3/scatterplot example because we don't usually have a nice arrow which wants a bit more margin.
filter
axis.filter([filter]) allows to set a filter which will control the rendering of domain, tick line and text
- Initially I wanted to make it depend on the datum, but it would mean to recheck each existing tick (line or text) to see if it still matches the filter, so maybe that's too much.
reach
axis.reach([reach]) allows to set a reach, which is like the innerSize, but in the opposite direction (into the chart), allowing to create a grid from the tick lines by calling e.g. axis.reach(width)
- I'm not sure about the name
- I'm not sure if this shouldn't be another layer of the axis (filter out by default if reach===0)
These options are demoed at https://observablehq.com/d/2e8bc58f05a8037a
This would be quite useful.
TODO:
- [ ] should filter be separated into filterTick and filterLabel? Often times you want the tick but not the label?
- [ ] I suppose reach===0 should create the grid lines (vs reach==null), in order to make transitions possible?