You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "saha23412 (via GitHub)" <gi...@apache.org> on 2025/11/26 13:49:45 UTC
[D] X-Axis Sort By does not work without Dimensions [superset]
GitHub user saha23412 created a discussion: X-Axis Sort By does not work without Dimensions
X-Axis Sort By only works if you specify Dimensions, is it possible to change something so that the sorting works when the Metrics item is selected.
-Without Dimensions:
<img width="1108" height="518" alt="image" src="https://github.com/user-attachments/assets/c5f5e8d4-5c63-4859-8c1e-a61489cc00b4" />
<img width="1108" height="440" alt="image" src="https://github.com/user-attachments/assets/494b0c69-88a0-463f-8f71-3a2b79add113" />
<img width="1098" height="477" alt="image" src="https://github.com/user-attachments/assets/9acb5f9d-b74d-4ba0-819c-d860b5b1fb0f" />
No sorting point changes the schedule.
-Dimensions selected.
<img width="1084" height="529" alt="image" src="https://github.com/user-attachments/assets/cf5436a8-ebc2-4905-bc30-d8b6e229cb4a" />
<img width="1109" height="547" alt="image" src="https://github.com/user-attachments/assets/4b5f2704-5195-419b-a718-f208bee915b0" />
<img width="1092" height="563" alt="image" src="https://github.com/user-attachments/assets/3baa1ae6-ad85-4ead-957f-9d1dadb58b4d" />
When Dimensions is specified, each sorting point affects the graph and its rendering.
GitHub link: https://github.com/apache/superset/discussions/36290
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] X-Axis Sort By does not work without Dimensions [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: X-Axis Sort By does not work without Dimensions
<!-- Answer -->
The way X-Axis Sort By works in Superset is intentional and depends on whether you have dimensions (groupby fields) selected. When no dimension is set, you can sort by any column or metric in your dataset. As soon as you add a dimension, the sort options are restricted to a fixed set: category name, total value, min, max, 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 [[source](https://github.com/apache/superset/issues/34352)].
If you want to sort by a metric when no dimensions are present, this should work in bar charts and similar chart types. If it's not working, double-check that your chart type supports this and that your configuration matches the expected setup. For chart types where this isn't supported (like Mixed Chart or some line charts), it's a feature request and not currently available [[source](https://github.com/apache/superset/issues/32412)].
There isn't a built-in workaround to sort by an arbitrary dataset column when a dimension is set. If you need a specific order, consider pre-sorting your data in the dataset or creating a calculated column that encodes your desired order, then use "Category name" sorting [[source](https://github.com/apache/superset/issues/34352)].
The relevant logic for this behavior is in the frontend code, specifically in the `xAxisSortControl` and `sortOperator` functions. Changing this would require a code enhancement [[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx#L59-L151)].
If you have a specific chart type or scenario where sorting by metric is not working as expected without dimensions, let me know which chart type and configuration you're using, and I can help you dig deeper.
<!-- 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/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9c8b9254-d053-435a-901d-9b8f261c936a?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20way%20X-Axis%20Sort%20By%20works%20in%20Superset%20is%20intentional%20and%20depends%20on%20whether%20you%20have%20dimensions%20%28groupby%20fields%29%20selected.%20When%20no%20dimension%20is%20set%2C%20you%20can%20sort%20by%20any%20column%20or%20metric%20in%20your%20dataset.%20As%20soon%20as%20you%20add%20a%20dimension%2C%20the%20sort%20options%20are%20restricted%20to%20a%20fixed%20set%3A%20category%20name%2C%20total%20value%2C%20min%2C%20max%2C%20and%20average%20value.%20This%20is%20hardcoded%20in%20the%20frontend%20and%20not%20a%20backend%20limitation%20or%20bug%E2%80%94it%27s%20how%20the%20control%20is%20designed%20to%20work%20in%20Superset%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34352%29%5D.%0A%0AIf%20you%20want%20to%
20sort%20by%20a%20metric%20when%20no%20dimensions%20are%20present%2C%20this%20should%20work%20in%20bar%20charts%20and%20similar%20chart%20types.%20If%20it%27s%20not%20working%2C%20double-check%20that%20your%20chart%20type%20supports%20this%20and%20that%20your%20configuration%20matches%20the%20expected%20setup.%20For%20chart%20types%20where%20this%20isn%27t%20supported%20%28like%20Mixed%20Chart%20or%20some%20line%20charts%29%2C%20it%27s%20a%20feature%20request%20and%20not%20currently%20available%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/32412%29%5D.%0A%0AThere%20isn%27t%20a%20built-in%20workaround%20to%20sort%20by%20an%20arbitrary%20dataset%20column%20when%20a%20dimension%20is%20set.%20If%20you%20need%20a%20specific%20order%2C%20consider%20pre-sorting%20your%20data%20in%20the%20dataset%20or%20creating%20a%20calculated%20column%20that%20encodes%20your%20desired%20order%2C%20then%20use%20%22Category%20name%22%20sorting%20%5B%5Bsource%5D%28https%3A//github.com/apac
he/superset/issues/34352%29%5D.%0A%0AThe%20relevant%20logic%20for%20this%20behavior%20is%20in%20the%20frontend%20code%2C%20specifically%20in%20the%20%60xAxisSortControl%60%20and%20%60sortOperator%60%20functions.%20Changing%20this%20would%20require%20a%20code%20enhancement%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx%23L59-L151%29%5D.%0A%0AIf%20you%20have%20a%20specific%20chart%20type%20or%20scenario%20where%20sorting%20by%20metric%20is%20not%20working%20as%20expected%20without%20dimensions%2C%20let%20me%20know%20which%20chart%20type%20and%20configuration%20you%27re%20using%2C%20and%20I%20can%20help%20you%20dig%20deeper.) [](https://go.dosu.dev/discord-bot) [](https://twitter.co
m/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36290)
GitHub link: https://github.com/apache/superset/discussions/36290#discussioncomment-15086947
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] X-Axis Sort By does not work without Dimensions [superset]
Posted by "saha23412 (via GitHub)" <gi...@apache.org>.
GitHub user saha23412 edited a discussion: X-Axis Sort By does not work without Dimensions
X-Axis Sort By only works if you specify Dimensions, is it possible to change something so that the sorting works when the Metrics item is selected.
-Without Dimensions:
<img width="1108" height="518" alt="image" src="https://github.com/user-attachments/assets/c5f5e8d4-5c63-4859-8c1e-a61489cc00b4" />
<img width="1108" height="440" alt="image" src="https://github.com/user-attachments/assets/494b0c69-88a0-463f-8f71-3a2b79add113" />
<img width="1098" height="477" alt="image" src="https://github.com/user-attachments/assets/9acb5f9d-b74d-4ba0-819c-d860b5b1fb0f" />
No sorting point changes the schedule.
-Dimensions selected.
<img width="1084" height="529" alt="image" src="https://github.com/user-attachments/assets/cf5436a8-ebc2-4905-bc30-d8b6e229cb4a" />
<img width="1109" height="547" alt="image" src="https://github.com/user-attachments/assets/4b5f2704-5195-419b-a718-f208bee915b0" />
<img width="1092" height="563" alt="image" src="https://github.com/user-attachments/assets/3baa1ae6-ad85-4ead-957f-9d1dadb58b4d" />
When Dimensions is specified, each sorting point affects the graph and its rendering.
I want to make the sorting work without Dimensions. Conditionally, if we specified Metrics, the sorting worked.
GitHub link: https://github.com/apache/superset/discussions/36290
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] X-Axis Sort By does not work without Dimensions [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: X-Axis Sort By does not work without Dimensions
<!-- Answer -->
The way X-Axis Sort By works in Superset is intentional and depends on whether you have dimensions (groupby fields) selected. When no dimension is set, you can sort by any column or metric in your dataset. As soon as you add a dimension, the sort options are restricted to a fixed set: category name, total value, min, max, 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 [[source](https://github.com/apache/superset/issues/34352)].
If you want to sort by a metric when no dimensions are present, this should work in bar charts and similar chart types. If it's not working, double-check that your chart type supports this and that your configuration matches the expected setup. For chart types where this isn't supported (like Mixed Chart or some line charts), it's a feature request and not currently available [[source](https://github.com/apache/superset/issues/32412)].
There isn't a built-in workaround to sort by an arbitrary dataset column when a dimension is set. If you need a specific order, consider pre-sorting your data in the dataset or creating a calculated column that encodes your desired order, then use "Category name" sorting [[source](https://github.com/apache/superset/issues/34352)].
The relevant logic for this behavior is in the frontend code, specifically in the `xAxisSortControl` and `sortOperator` functions. Changing this would require a code enhancement [[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx#L59-L151)].
If you have a specific chart type or scenario where sorting by metric is not working as expected without dimensions, let me know which chart type and configuration you're using, and I can help you dig deeper.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=9c8b9254-d053-435a-901d-9b8f261c936a) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/36290#discussioncomment-15086947
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org