Ticks around binary prefixes?
When I’m plotting bits (or more likely bytes) it would be nice if I could arrange the ticks on the round binary prefix values, e.g. ["0.5 GiB", "1.0 GiB", "1.5 GiB", "2.0 GiB"] rather then on the SI prefix values.
This will be especially nice if d3/d3-format#33 goes through since .tickFormat(".2B") (where B indicated binary prefix) would create really ugly ticks.
d3.ticks (which is the basis of most scale.ticks implementations) is based on powers of ten, so I’m not sure if there’s a clean way to change the tick generation strategy. Though of course you can pass whatever values you want I axis.tickValues. Presumably the first thing we’d want is a standalone implementation of tick generation, in the style of d3.ticks but for binary prefix values. That work would happen in d3-array. Maybe call it d3.ticksBinary?
(It might be possible for scale.ticks to parse the tick format specifier, if it’s a string, and look for the B directive. The tick format specifier is typically passed to both scale.ticks and scale.tickFormat by the axis, though typically scale.ticks ignores the additional argument. But that could provide a very elegant way of switching both the tick generation method and the format with a single call to axis.ticks.)
@mbostock Thanks for the response. I’ll look into d3-array and see if I find time to open a PR with the changes necessary.
Opened issue to add base to d3-array#ticks method. https://github.com/d3/d3-array/issues/232. ~Not sure how this would impact tick nicing~ Changes to tickIncrement would apply these changes to nicing automatically, would just need to pass the base value.