fix: color palette properly applied to bar charts
- ensureStyle: handle empty colors array (use defaults) - barOptionBuilder: set option.color = style.colors globally so ECharts auto-assigns palette colors to all series - Changing palette in style panel now updates chart colors immediately Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53669b66b8
commit
1ee9d57222
|
|
@ -34,6 +34,7 @@ function applyCommonStyle(option: Record<string, any>, style: StyleConfig): void
|
|||
option.legend = { show: false };
|
||||
}
|
||||
|
||||
option.color = style.colors;
|
||||
option.backgroundColor = style.background.color !== '' ? style.background.color : 'transparent';
|
||||
|
||||
if (style.animation.enabled) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function ensureStyle(style: any): StyleConfig {
|
|||
if (!style || typeof style !== 'object') return DEFAULT_STYLE;
|
||||
return {
|
||||
title: { ...DEFAULT_STYLE.title, ...(style.title ?? {}) },
|
||||
colors: style.colors ?? DEFAULT_STYLE.colors,
|
||||
colors: (Array.isArray(style.colors) && style.colors.length > 0) ? style.colors : DEFAULT_STYLE.colors,
|
||||
legend: { ...DEFAULT_STYLE.legend, ...(style.legend ?? {}) },
|
||||
xAxis: { ...DEFAULT_STYLE.xAxis, ...(style.xAxis ?? {}) },
|
||||
yAxis: { ...DEFAULT_STYLE.yAxis, ...(style.yAxis ?? {}) },
|
||||
|
|
|
|||
Loading…
Reference in New Issue