Skip to content

The SortOrder interface could support a reverse option? #1460

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

Closed
mbostock opened this issue Apr 17, 2023 · 1 comment · Fixed by #1607
Closed

The SortOrder interface could support a reverse option? #1460

mbostock opened this issue Apr 17, 2023 · 1 comment · Fixed by #1607
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

I was struggling to remember I needed to specify order: "descending" instead of reverse: true. Perhaps we could support both?

@mbostock mbostock added the enhancement New feature or request label Apr 17, 2023
@mbostock
Copy link
Member Author

The use of reverse: boolean in ChannelDomainOptions is confusing because it doesn’t mean (exactly) to reverse the order: it means to use descending natural order instead of ascending natural order. The difference is that descending natural order still puts null/unorderable values last, whereas reversing ascending natural order would put null/unorderable values first. Therefore it would probably make more sense to add a order option to the ChannelDomainOptions interface, and change the meaning of the reverse option so that it puts nulls first (assuming that you leave order as the default ascending). We could also allow the order option in ChannelDomainOptions to be specified as a comparator function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant