Skip to content

Conversation

@dtunikov
Copy link

@dtunikov dtunikov commented Dec 1, 2025

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

Add ability to control sorting of count-plot bars from the UI:
- sortBy: sort by total count ("all") or selected/filtered count ("sel")
- sortOrder: ascending or descending order

Special values (null, other) remain at the bottom regardless of sort settings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@dtunikov
Copy link
Author

dtunikov commented Dec 1, 2025

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?

@domoritz
Copy link
Member

domoritz commented Dec 1, 2025

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

sortBy: "total" | "selected" | undefined,
sortOrder: "asc" | "desc" | undefined,
) {
// Split into regular items and special items (null, other)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code iterates over the items two times. Would it be faster and simpler to use the special item index like before and then to use slice to split the array?

A unit test could also be good here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants