-
Notifications
You must be signed in to change notification settings - Fork 31
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
Sorted ordinal regression #151
Comments
Can you make a LayerCake-only repro in the REPL so I can check it out? |
I just tweaked the column example... https://svelte.dev/repl/2d4d21d550c446f181b067490fcc25bb?version=3.46.2 Note, if you leave the date's as strings... they are sorted as expected... but if they are So far I've only looked into this Date example... although I'm a little leery of always sorting ordinal data, especially without a way to opt-out (although I don't have a good example at the moment, so maybe it's not an issue in practice). |
Thanks I’ll take a look. You can always override it by setting the xDomain manually. xDomain = […new Set(data.map(d => d[xKey])] |
I believe the oddly sorted dates in the example above are getting sorted to the toLocalString representation of the date objects, which starts with day of the week. (Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday). https://svelte.dev/repl/b1a6573b77244700af2dd9ac4350abe1?version=4.2.1 |
Looks like adding a sort function should fix it https://svelte.dev/repl/28f554b370cf4cc484a5153e257888ca?version=4.2.1 |
To say more about whether this is a good default, my thinking was the alternative is it will display in the order it appears in your data, which has no real guarantees and may not be something people think of when trying to debug stuff. I figured a sorted domain was a sensible default but mostly exists to display something halfway decent on first load and people can always override it if they want the domain to be different. the previous behavior also led to some unexpected behavior when using color scales in combination with data filtering. lets say you had a scatterplot or a beeswarm and you wanted to highlight a few elements and map to a color range of tl;dr choosing between a random sort order or a sorted one as an initial state that can be overridden, it seemed to make more sense to have a stable order |
@techniq @mattlangeman take a look at what I have in #151, which I think should fix it for you. I'll let it sit for a few hours before merging it in case there's something I missed. |
Fixed in 8.0.1 |
@mhkeller Looks like a publishing issue.... what I see in |
Sorry – still not used to the new build system with svelte kit. 8.0.2 should be properly built now... |
Thanks for the catch |
8.0.0
(PR: #148) appears to have a regression when usingDate
instances - techniq/layerchart#54.I haven't looked exhaustively, but I think this affects many of the ordinal examples (I could be wrong, but this might be affecting the order of the Pie.
Is it possible to:
Date
instancesThe text was updated successfully, but these errors were encountered: