Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can any scale be used? #43

Closed
Frikki opened this issue Oct 27, 2017 · 1 comment
Closed

Can any scale be used? #43

Frikki opened this issue Oct 27, 2017 · 1 comment

Comments

@Frikki
Copy link

Frikki commented Oct 27, 2017

Can I, for example, use a ScaleOrdinal where the range isn't a number list? I'm particularly concerned about this code: https://github.com/d3/d3-axis/blob/master/src/axis.js#L51

@mbostock
Copy link
Member

mbostock commented Oct 27, 2017

The scale must be a positional scale to be displayed as an axis, so the range must be numeric. What do you have if you don’t have a numeric range? Perhaps you’re looking for a legend?

Typically a scaleBand or scalePoint would be used instead of scaleOrdinal, but you can use a scaleOrdinal as long as the range is numeric and in either ascending or descending order.

https://bl.ocks.org/mbostock/268bb5fb6e1025b60f01a35311ed798b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants