YousufFFFF opened a new pull request, #36214: URL: https://github.com/apache/superset/pull/36214
<!--- fix(timeseries): correct x-axis ordering for string and numeric-like dimensions --> ### SUMMARY Fixes #35853 This PR fixes incorrect x-axis ordering in the ECharts Timeseries chart when the dimension is a string or a numeric-like string (e.g. "202401", "10", "2"). Superset previously passed unordered data arrays to ECharts, causing curves to connect non-adjacent categories and produce visually incorrect line charts. This PR adds a natural sorting step inside `transformProps.ts`, ensuring that x-values are always sorted correctly before rendering. It also adds explicit boolean coercion (`Boolean(...)`) to stabilize props such as `connectNulls` and `showValue`, which could previously receive undefined or non-boolean values. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF  attachments/assets/46ef6156-c89e-44f3-8725-948f453876fe) ### BEFORE - AFTER DESCRIPTION --> Before (current Superset behavior) String or numeric-like string x-axis values (e.g., "202401", "202402", "202410") are sorted lexicographically, not numerically. This causes the line chart to skip intermediate categories and draw incorrect zig-zag connections. Example (Before) X-axis order: 202401, 202403, 202407, 202410, 202411 Chart connects: 202401 → 202410 → 202407 → 202411 This creates visually wrong jumps and misleading trends. <img width="1045" height="384" alt="image" src="https://github.com/user-attachments/assets/0b344176-eff8-49c2-983f-289949173b87" /> -->After (with this patch) The fix applies natural numeric sorting for non-temporal dimensions. "202401", "202402", … "202410" now sort as proper numbers, not strings. Example (After) X-axis order: 202401, 202402, 202403, 202404, 202405, 202406... Chart now connects points in correct numeric order, producing a smooth and correct line. <img width="1506" height="847" alt="image" src="https://github.com/user-attachments/assets/b0368640-06ae-4ab7-8766-6e4ecfad37ef" /> ### TESTING INSTRUCTIONS 1. Create or open a Timeseries Line chart. 2. Use a **string dimension** such as: - `"202401", "202402", "202403"` - `"1", "2", "10"` - `"A02", "A10", "A03"` 3. Verify that: - The chart now renders points **in natural (numeric-aware) order**. - Lines no longer “jump backward” or connect non-adjacent categories. 4. Enable/disable options like **Connect Nulls** or **Show Value**. - Verify they now behave consistently due to boolean coercion. ### ADDITIONAL INFORMATION - [ ] Has associated issue: None - [ ] Required feature flags: None - [ ] Changes UI: No - [ ] Includes DB Migration: No - [ ] Introduces new feature or API: No - [ ] Removes existing feature or API: No **Files touched:** - `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts` The change is self-contained, does not modify schemas or UI, and should have no side effects beyond improving x-axis correctness. -- 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]
