GitHub user PALLAVIKHEDLE added a comment to the discussion: ECharts options
overrides in themes: How to target specific chart instance
At the moment, Superset doesn’t support applying ECharts overrides to a
specific chart instance. The theme system only lets you override options
`globally` or `per chart type`, so all charts of the same type (for example,
multiple Time Series charts on one dashboard) will get the same ECharts
configuration.
If you need chart-specific tweaks
1. You can use dashboard CSS to target a specific chart by its chart ID, but
this only helps with styling, not ECharts behavior.
2. add a third theme token keyed by slice/chart id, then have the ECharts
renderer apply it for that one chart only.
`// theme.ts
export default {
echartsOptionsOverridesBySliceId: {
146: { /* only chart (slice) 146 */ },
233: { /* only chart (slice) 233 */ },
},
};
`
3. Add a per-slice token to the theme types
Find the theme typing (often in
superset-frontend/packages/superset-ui-core/src/style/types.ts or similar) and
add:
`export type SupersetTheme = {
// existing...
echartsOptionsOverrides?: Record<string, any>;
echartsOptionsOverridesByChartType?: Record<string, Record<string, any>>;
// add this:
echartsOptionsOverridesBySliceId?: Record<number, Record<string, any>>;
};
`
(Exact file path varies a bit by version, but there’s a central SupersetTheme
type.)
GitHub link:
https://github.com/apache/superset/discussions/36851#discussioncomment-15447578
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]