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

   <!-- Answer -->
   The difference in "X-AXIS SORT BY" options when a dimension is set in bar 
charts is intentional and comes from how the frontend control logic is 
implemented. When no dimension is set, you can sort by any column or metric in 
your dataset. But as soon as you add a dimension (i.e., use "DIMENSIONS" to 
group or stack), the sort options are restricted to a fixed set: category name, 
total value, minimum value, maximum value, and average value. This is hardcoded 
in the frontend and not a backend limitation or bug—it's how the control is 
designed to work in Superset 4.1.3 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx)].
   
   There isn't a built-in workaround to sort by an arbitrary dataset column 
when a dimension is set. If you need to sort by a specific column, you might 
consider pre-sorting your data in the dataset or creating a calculated column 
that encodes your desired order, then use "Category name" sorting. Otherwise, 
this limitation would require a feature enhancement in Superset.
   
   If you want to review or customize this behavior, the relevant logic is in 
the frontend code, specifically in the `xAxisSortControl` and the 
`SORT_SERIES_CHOICES` constant 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/constants.ts)].
   
   
   <!-- 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/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f971480d-1742-45f1-ac19-e385ab9b5509?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&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