sfirke commented on code in PR #44588:
URL: https://github.com/apache/superset/pull/44588#discussion_r4105486103
##########
superset-frontend/plugins/plugin-chart-echarts/src/Heatmap/transformProps.ts:
##########
@@ -266,10 +266,14 @@ export default function transformProps(
metricLabel,
xAxisColumnName,
);
+ // Unlike the X-axis (often a temporal column that already arrives from
+ // the backend in a natural, e.g. chronological, order), the Y-axis
+ // groupby dimension has no such natural ordering to fall back on, so
+ // default it to ascending sort when the user hasn't chosen one.
const sortedYAxisValues = sortAxisValues(
yAxisValues,
data,
- sortYAxis,
+ sortYAxis ?? 'alpha_asc',
Review Comment:
Applying the default here rather than on the control has two side effects
worth weighing:
1. `sort_y_axis` in `controlPanel.tsx` is `clearable: true` with no
`default`, so a cleared control now shows empty while the chart renders
`alpha_asc`. The UI no longer reflects what the chart does.
2. "Keep the query's row order" is no longer reachable at all. Any existing
heatmap whose virtual dataset orders an ordinal Y dimension (`Low/Medium/High`,
weekday names, `Q1 FY24`...) will re-sort alphabetically on next load, and the
user has no way to restore the old rendering because the only unset state now
maps to alphabetical.
Would `default: 'alpha_asc'` on the `sort_y_axis` control work instead? New
charts get the sorted default, the control shows what the chart is doing, and
clearing it still means "no sort" in both `buildQuery.ts` and here.
If you'd rather keep the transform-level fallback, `buildQuery.ts` should
probably apply the same default so the backend `ORDER BY` and the frontend
re-sort agree under `row_limit`. Otherwise the limited row set is chosen in
arbitrary order and only sorted afterwards.
---
🤖 _Drafted by Claude Code, reviewed and approved by @sfirke._
--
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]