dosubot[bot] commented on issue #34267: URL: https://github.com/apache/superset/issues/34267#issuecomment-3101698685
<!-- Greeting --> Hi @plus-zhang! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> In Superset 5.0.0, sorting a line chart's categorical x-axis (like a varchar "version" field) by a different field (such as "prod_dt") is not supported out of the box. The "Force Categorical" option only appears for numeric columns, not varchar fields, and the x-axis sort controls only allow sorting by the x-axis field itself or relevant metrics—not by an unrelated field like "prod_dt" [reference](https://github.com/apache/superset/issues/31696) [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx). A common workaround is to pre-sort your dataset or create a calculated field in your source query or dataset that encodes the desired sort order, then use that as your x-axis. Alternatively, some chart types (like Bar Chart) have more flexible sorting options [reference](https://github.com/apache/superset/issues/32412). If you need this feature in line charts, it would require a new control and deeper changes to Superset's data model and query generator. <!-- 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/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/12bfcad4-8931-4730-87a5-ab83656d137e?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [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/34267) -- 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]
