sadpandajoe opened a new pull request, #44588:
URL: https://github.com/apache/superset/pull/44588

   ### SUMMARY
   The Heatmap chart's Y-axis did not sort when it held string category values 
(e.g.
   customer names) and no explicit "Sort Y Axis" option was chosen — categories 
rendered
   in arbitrary query/insertion order instead of a sensible default. The 
existing "Sort Y
   Axis" control already had a numeric-aware, locale-aware comparator, but it 
was only
   ever invoked when a user explicitly picked a sort option; leaving it unset 
(the common
   case for a freshly created chart) skipped sorting entirely.
   
   This adds a default of `alpha_asc` for the Y-axis when no sort option is 
chosen, so a
   fresh Heatmap sorts its Y-axis alphabetically by default. Explicit sort 
choices
   (`alpha_desc`, `value_asc`, `value_desc`) are unaffected — the default only 
applies to
   the previously-unhandled "nothing chosen" case.
   
   Note: this also changes the rendered order for any existing chart that 
currently has no
   Y-axis sort chosen (whether because it predates this control, or a user 
cleared it via
   the control's own clear option). We looked for a way to distinguish those 
two cases so
   only new charts would be affected, but traced every layer between the 
control and the
   chart render (control state, form data serialization, chart transform) and 
found no
   place where "explicitly cleared" and "never set" remain distinguishable — 
both collapse
   to the same value everywhere. We chose to fix the common case (a chart that 
should sort
   but doesn't) rather than leave the reported bug unfixed indefinitely.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before: a Heatmap with a string Y-axis (e.g. a name column) and no sort 
option chosen
   renders categories in arbitrary/insertion order.
   After: the same chart renders with Y-axis categories sorted alphabetically.
   (Evidence to follow, captured against this PR's reviewed HEAD.)
   
   ### TESTING INSTRUCTIONS
   1. Create a Heatmap chart (any dataset with a string dimension) — e.g. a 
temporal
      column for the X-axis, a string column for the Y-axis, `COUNT(*)` for 
Metrics.
   2. Leave "Sort Y Axis" unset.
   3. Click **Update Chart** — the Y-axis should render sorted alphabetically.
   4. Explicitly choose a different Y-axis sort option (e.g. sort by value, 
descending) —
      confirm it still takes effect and overrides the default.
   5. `npm test -- Heatmap` in `superset-frontend/plugins/plugin-chart-echarts` 
— the added
      regression test should pass.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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