dosubot[bot] commented on issue #34352:
URL: https://github.com/apache/superset/issues/34352#issuecomment-3836112713

   <!-- Answer -->
   This isn't a new regression in 6.0.0, but rather a longstanding limitation 
that was solidified in the frontend logic between 4.1.4 and 6.0.0. When you add 
a dimension (groupby) to a bar chart, the "X-Axis Sort By" dropdown is 
intentionally restricted to a fixed set of options—category name, total value, 
min, max, and average—rather than allowing you to sort by any arbitrary column 
like "Day_Numeric". This is controlled by the frontend code, specifically the 
`xAxisSortControl` and the `SORT_SERIES_CHOICES` constant, and was refactored 
and made stricter in [PR #30393](https://github.com/apache/superset/pull/30393) 
(merged September 2024) and further refined in [PR 
#37115](https://github.com/apache/superset/pull/37115) (January 2026) 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx)].
   
   There’s no built-in way to sort by a different numeric column when a 
dimension is set. The common workaround is to pre-sort your data or create a 
calculated field that encodes your desired order, then use "Category name" 
sorting [[discussion](https://github.com/apache/superset/discussions/36290)]. 
If you need the old behavior, the "Bar Chart (legacy)" may still allow it, but 
the ECharts bar chart does not.
   
   Let me know if you want more technical details or guidance on implementing a 
workaround.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/4fe8f8be-5f84-4361-8f4f-3ad89589e219?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20isn%27t%20a%20new%20regression%20in%206.0.0%2C%20but%20rather%20a%20longstanding%20limitation%20that%20was%20solidified%20in%20the%20frontend%20logic%20between%204.1.4%20and%206.0.0.%20When%20you%20add%20a%20dimension%20%28groupby%29%20to%20a%20bar%20chart%2C%20the%20%22X-Axis%20Sort%20By%22%20dropdown%20is%20intentionally%20restricted%20to%20a%20fixed%20set%20of%20options%E2%80%94category%20name%2C%20total%20value%2C%20min%2C%20max%2C%20and%20average%E2%80%94rather%20than%20allowing%20you%20to%20sort%20by%20any%20arbitrary%20column%20like%20%22Day_Numeric%22.%20This%20is%20controlled%20by%20the%20frontend%20code%2C%20specifically%20the%20%60xAxisSortControl%60%20and%20the%20%60SORT_SERIES_CHOICES%60%20constant%2C%20and%20was%20refactored%20
 
and%20made%20stricter%20in%20%5BPR%20%2330393%5D%28https%3A//github.com/apache/superset/pull/30393%29%20%28merged%20September%202024%29%20and%20further%20refined%20in%20%5BPR%20%2337115%5D%28https%3A//github.com/apache/superset/pull/37115%29%20%28January%202026%29%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx%29%5D.%0A%0AThere%E2%80%99s%20no%20built-in%20way%20to%20sort%20by%20a%20different%20numeric%20column%20when%20a%20dimension%20is%20set.%20The%20common%20workaround%20is%20to%20pre-sort%20your%20data%20or%20create%20a%20calculated%20field%20that%20encodes%20your%20desired%20order%2C%20then%20use%20%22Category%20name%22%20sorting%20%5B%5Bdiscussion%5D%28https%3A//github.com/apache/superset/discussions/36290%29%5D.%20If%20you%20need%20the%20old%20behavior%2C%20the%20%22Bar%20Chart%20%28legacy%29%22%20may%20still%20allow%20it%2C%20bu
 
t%20the%20ECharts%20bar%20chart%20does%20not.%0A%0ALet%20me%20know%20if%20you%20want%20more%20technical%20details%20or%20guidance%20on%20implementing%20a%20workaround.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34352)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to