andredionildo commented on issue #32591: URL: https://github.com/apache/superset/issues/32591#issuecomment-3707352205
### Bug: ECharts Heatmap Y-axis category order changes after filtering (weekdays become reordered) **Superset version:** 6.0.0 **DB:** Postgres **Chart:** ECharts Heatmap **Timezone used in query:** Europe/Lisbon This behavior appears to be already reported in issues [#32591](https://github.com/apache/superset/issues/32591), [#33245](https://github.com/apache/superset/issues/33245) and [#31318](https://github.com/apache/superset/issues/31318); however, the problem is still present in Superset 6.0.0, as the Y-axis category order continues to change when applying filters or short time ranges. #### Summary When I apply filters (e.g. filtering to a single user, or changing the time range to “Last week/Last month”), the **Y-axis category order changes** in the ECharts Heatmap. Even with **Y-axis sorting configured as Ascending**, the Y-axis is no longer stable (e.g. weekday labels no longer stay Monday → Sunday). This is especially noticeable when the filtered dataset becomes **sparse** (some weekday/hour combinations are missing), at which point the Y-axis order appears to be derived from result ordering / first-seen values rather than the configured sort. #### Steps to reproduce 1. Create an **ECharts Heatmap** with: - X axis: `hour_of_day` (0–23) - Y axis: `day_of_week_label` (string) - Metric: `COUNT(*)` 2. Configure sorting: - X-axis sort = Ascending - Y-axis sort = Ascending 3. Use weekday labels that are explicitly sortable (numeric prefix), e.g.: - `01 - Monday`, `02 - Tuesday`, …, `07 - Sunday` 4. Apply a filter that removes many rows (e.g. filter to a single user, or set a short time range like last 7 days) so that some weekday/hour combinations become missing. 5. Observe that the Y-axis weekday order changes. #### Expected behavior The Y-axis categories should remain **stable and correctly ordered** (e.g. `01 - Monday` → `07 - Sunday`) regardless of filters / time range, as long as Y-axis sort is set to Ascending. #### Actual behavior After applying filters / changing time range, the Y-axis weekday categories become reordered (order changes depending on the filtered result set), even though Y-axis sorting is set to Ascending. #### Minimal SQL example (sanitized) ```sql SELECT CAST(EXTRACT(HOUR FROM ts AT TIME ZONE 'Europe/Lisbon') AS INT) AS hour_of_day, LPAD(CAST(EXTRACT(ISODOW FROM ts AT TIME ZONE 'Europe/Lisbon') AS TEXT), 2, '0') || ' - ' || CASE EXTRACT(ISODOW FROM ts AT TIME ZONE 'Europe/Lisbon') WHEN 1 THEN 'Monday' WHEN 2 THEN 'Tuesday' WHEN 3 THEN 'Wednesday' WHEN 4 THEN 'Thursday' WHEN 5 THEN 'Friday' WHEN 6 THEN 'Saturday' WHEN 7 THEN 'Sunday' END AS day_of_week_label, COUNT(*) AS cnt FROM some_table WHERE role = 'assistant' AND user_id = '<single_user_filter>' -- makes data sparse AND ts >= NOW() - INTERVAL '7 days' -- example timeframe filter GROUP BY 1,2 ORDER BY hour_of_day ASC, day_of_week_label ASC; -- 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]
