Allow specification of custom sort order for result labels
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 49.3k
- Forks
- 6.8k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 653
Description
**Is your feature request related to a problem? Please describe.**
When using bar charts , I often want to rearrange the order of the bars. This order comes from the sort order of the values in the results (and can be influenced by D3 axes as well), which does not always match the most useful ordering on an axis.
Simple example - the strings "First", "Second", "Third", "Fourth", if sorted by string order wouldn't be all that useful.
This is the more generic version of #5401
**Describe the solution you'd like**
The two ways to do this would either be:
1. Create a "label" concept, where there would be a map (eg {1: "First", 2: "Second", 3:"Third", 4:"Fourth"} for the example above, where the internals of the query (sorting, filtering, etc) would work with 1s and 2s.
2. Create a custom sort order (the request here), which would result in a custom ORDER BY clause, eg for the example above:
```
order by
CASE
WHEN step = 'First' then 1
WHEN step = 'Second' then 2
WHEN step = 'Third' then 3
WHEN step = 'Fourth' then 4
End
```
**Describe alternatives you've considered**
I've been using raw SQL for this.
**How important is this feature to you?**
It would bring more joy to working with bar charts and funnel charts.
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by tracing how result labels and sort order reach bar and funnel charts, then compare that path with query ORDER BY handling. Done means users can specify a custom label order that is preserved in query results and chart axes without relying on raw SQL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, sql
- Domain
- data-visualization, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100