feat: add sorting controls to count-plot chart
Summary
- Add ability to control sorting of count-plot bars from the UI
- New
sortByoption: sort by total count ("all") or selected/filtered count ("sel") - New
sortOrderoption: ascending (↑) or descending (↓) order - Special values (null, other) remain at the bottom regardless of sort settings
Test plan
- [ ] Open a count-plot chart with categorical data
- [ ] Verify the new sorting controls (↓/↑ and all/sel) appear next to the % toggle
- [ ] Test sorting by total count in descending order (default)
- [ ] Test sorting by total count in ascending order
- [ ] Test sorting by selected count when a filter is active
- [ ] Verify special values (null, other) stay at the bottom with a separator
🤖 Generated with Claude Code
Hi!
We have a use case where we want to sort entries in count-plot chart by the amount of entries matching current selection (in our case it's coming from applying a filter on chart1 and ordering the other charts accordingly)
Does it make sense?
Makes sense. Can you execute the test plan and carefully review the code since you used ai to generate it?
We group items with smaller total count into the "(other)" category when there are too many distinct values. If we sort by count in selection, it will be possible that the top selected count is an item in the "(other)" category. The current code seems to sort after the SQL query, which means the "(other)" category is considered as a unit to sort. Is this what you intend, or do you intend to see the top item under "(other)"?