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

Linear scale with one value generates no tick. #113

Closed
kanitw opened this issue Aug 11, 2017 · 6 comments · May be fixed by intel/ui-widget-toolkit#11
Closed

Linear scale with one value generates no tick. #113

kanitw opened this issue Aug 11, 2017 · 6 comments · May be fixed by intel/ui-widget-toolkit#11

Comments

@kanitw
Copy link

kanitw commented Aug 11, 2017

d3.scaleLinear().domain([4,4]).range([0,100]).ticks()

produces

[]

as a result, an axis from this scale would have no tick, which would be quite confusing for users

image

It might be better to generate a single tick and place items at the midpoint of the range rather than the minimum point just like what Tableau does:

image

@mbostock
Copy link
Member

Fixed in d3-array@1.2.1. Thanks for the report!

@kanitw
Copy link
Author

kanitw commented Sep 25, 2017

cc: @jheer

@jheer
Copy link
Contributor

jheer commented Sep 28, 2017

The fix in d3-array 1.2.1 does indeed add tick marks for singular domains. Thanks!

The report above also included a request for having singular domain values map to the middle of the scale range rather than the start of the range. Is there interest in supporting this aspect as well, or should we assume that the D3 scale convention will not change? Thanks again.

@mbostock
Copy link
Member

Can you file a separate issue? I think that’s doable but it is a bigger change.

@mbostock
Copy link
Member

Filed as #117.

@mbostock
Copy link
Member

mbostock commented Jan 26, 2019

This separate issue will be fixed in #156 d3-scale 2.2.

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

Successfully merging a pull request may close this issue.

3 participants