Bar chart "X-AXIS SORT BY" options differ when "DIMENSIONS" is set
- Dominant language
- Python
- Stars
- 74.8k
- Forks
- 18.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 692
Description
### Bug description
When creating a bar chart there is the option to sort the x-axis or y-axis when in horizontal mode. This dropdown option presents different values when a dimension is defined in the section "DIMENSIONS" compared to when there is no dimension defined.
In our case we want to order the x-axis by another column in our dataset, so we fill the "SORT BY" section as follows:
then we get the following options to sort the x-axis, which work well and allow us to order the x-axis by that dataset column:
however, when we define a dimension to present our metric stacked by that dimension the options to sort the x-axis change to this:
This way we are not able to order the x-axis by the order column in our dataset.
Thank you for your time in advance.
NOTE: Using the chart "Bar Chart (legacy)" we can achieve the intended x-axis ordering with the following configuration:
### Screenshots/recordings
_No response_
### Superset version
4.1.3
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Contributor guide
Research direction
Reproduce the issue in Superset 4.1.3 by comparing the Bar Chart configuration with and without a DIMENSIONS value, then compare it with Bar Chart (legacy). Trace the chart control entry point responsible for X-AXIS SORT BY and determine why the dataset's order column disappears when a dimension is set; done means that column remains available for sorting in the stacked chart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, react
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100