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

   ## Summary
   
   This PR adds a custom merge function for ECharts theme overrides that 
enables theme authors to apply default styles to **all items** in array-based 
ECharts options (like `series`, `xAxis`, `yAxis`, `dataZoom`, etc.) using a 
simple object syntax.
   
   ### The Problem
   
   Previously, `mergeReplaceArrays` would replace arrays entirely. This made it 
**impossible** to set default styles for all series items via theme overrides:
   
   ```js
   // ❌ BEFORE: This didn't work!
   echartsOptionsOverridesByChartType: {
     echarts_bar: {
       // Specifying series as an object was ignored because the chart's
       // series is an array, and object-to-array merge doesn't make sense
       series: { itemStyle: { borderRadius: 4 } }
     }
   }
   ```
   
   The only workaround was to replace the entire series array, which would 
break the chart since you'd lose all the actual data.
   
   ### The Solution
   
   The new `mergeEchartsThemeOverrides` function detects when you're merging an 
object into an array and applies the object to **each array item**:
   
   ```js
   // ✅ AFTER: This now works!
   echartsOptionsOverridesByChartType: {
     echarts_bar: {
       // Applied to ALL bar series - each one gets borderRadius: 4
       series: { itemStyle: { borderRadius: 4 } },
       // Applied to ALL y-axes (for charts with multiple axes)
       yAxis: { axisLabel: { rotate: 45 } }
     }
   }
   ```
   
   ### What's Now Possible
   
   | Override | Effect |
   |----------|--------|
   | `series: { itemStyle: { borderRadius: 4 } }` | All series get rounded 
corners |
   | `series: { label: { show: true, fontSize: 12 } }` | All series show labels 
|
   | `xAxis: { axisLabel: { rotate: 45 } }` | All x-axes get rotated labels |
   | `yAxis: { splitLine: { show: false } }` | All y-axes hide grid lines |
   | `dataZoom: { filterMode: 'filter' }` | All data zoom controls use filter 
mode |
   
   ### Backward Compatibility
   
   Array overrides still replace entirely (existing behavior preserved):
   
   ```js
   // This still works as before - replaces the entire series array
   series: [{ type: 'pie', data: [...] }]
   ```
   
   ## Test plan
   
   - [x] 18 unit tests covering all scenarios
   - [x] TypeScript compiles correctly
   - [x] Basic deep merge behavior preserved
   - [x] Array replacement (backward compat) still works
   - [x] Object-to-array merging works for series, xAxis, yAxis, dataZoom
   - [x] Edge cases handled (non-object items, empty overrides, missing 
properties)
   
   🤖 Generated with [Claude Code](https://claude.com/code)


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