embedding-atlas icon indicating copy to clipboard operation
embedding-atlas copied to clipboard

feat: add sorting controls to count-plot chart

Open dtunikov opened this issue 3 months ago • 3 comments

Summary

  • Add ability to control sorting of count-plot bars from the UI
  • New sortBy option: sort by total count ("all") or selected/filtered count ("sel")
  • New sortOrder option: 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

dtunikov avatar Dec 01 '25 10:12 dtunikov

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?

dtunikov avatar Dec 01 '25 10:12 dtunikov

Makes sense. Can you execute the test plan and carefully review the code since you used ai to generate it?

domoritz avatar Dec 01 '25 11:12 domoritz

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)"?

donghaoren avatar Dec 01 '25 18:12 donghaoren