Should auto-calculated ordinal domain return sorted?
Currently, if you set an accessor for x y or z and you pass in an ordinal scale, the domain will be calculated as unique elements, say, for a color scale. The order of these unique elements is just based on when they appear in the data. Should .sort() be called on them so that the appearance is more consistent?
This could be a potential breaking change for some charts.
Yea I think this would be a good idea.
Implemented in 8.0.0
I'm re-opening this since some people have found this behavior surprising. Maybe better to turn this off by default. Any thoughts welcome
@techniq @rgieseke @jtrim-ons any preference on this one?
I personally find it surprising, and while yDomain={[...new Set(data.map((d) => d.name))]} does work, I think reverting to the pre-8.0.0 state would be a better default IMO, but not major if you don't.
I have no strong preference here, thanks for the heads-up! Not sure if there is an example in the gallery which demonstrates this already?
@techniq For what it's worth, since 8.1.0 you should be able to set xDomainSort={false} and avoid the step of looping through your data to get the uniques.