mistercrunch opened a new pull request, #34876:
URL: https://github.com/apache/superset/pull/34876
## Summary
Implements fine-grained theming control for ECharts visualizations through
the Superset theme system. Users can now override ECharts configuration options
globally or per chart type without modifying individual chart configurations.
## Key Features
- **Global overrides**: Apply settings to all ECharts visualizations via
`echartsOptionsOverrides`
- **Chart-specific overrides**: Target specific chart types via
`echartsOptionsOverridesByChartType`
- **Smart merging**: Deep object merging with array replacement using lodash
`mergeWith`
- **Proper precedence**: Chart-specific > Global > Plugin defaults > Base
theme
## Technical Implementation
- Added theme interface properties to `SupersetTheme` with TypeScript support
- Enhanced core `Echart.tsx` component with intelligent merge logic at
single injection point
- Updated chart components to pass `vizType` for chart-specific targeting
- Implemented custom array replacement logic to ensure proper ECharts
configuration behavior
## Testing & Validation
- Comprehensive unit tests covering merge behavior and edge cases
- All pre-commit hooks passing (ESLint, TypeScript, formatting)
- Documentation updated with usage examples and best practices
## Usage Example
```javascript
// Theme configuration
{
echartsOptionsOverrides: {
grid: { left: "10%", right: "10%" },
tooltip: { backgroundColor: "rgba(0,0,0,0.8)" }
},
echartsOptionsOverridesByChartType: {
echarts_pie: { legend: { orient: "vertical" } },
echarts_timeseries: { xAxis: { axisLabel: { rotate: 45 } } }
}
}
```
This enables powerful corporate branding and custom styling capabilities
while maintaining backward compatibility.
--
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]