Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions common/changes/@visactor/vchart/develop_2026-03-11-03-30.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: fix theme config of spec and option\n\n",
"type": "none",
"packageName": "@visactor/vchart"
}
],
"packageName": "@visactor/vchart",
"email": "dingling112@gmail.com"
}
34 changes: 13 additions & 21 deletions packages/vchart/src/core/vchart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,27 +1471,19 @@ export class VChart implements IVChart {
// 处理 specTheme 和 optionTheme, merge -> transform
// 优先级 currentTheme < optionTheme < specTheme
if (!isEmpty(optionTheme) || !isEmpty(specTheme)) {
if (
(isString(optionTheme) && (!specTheme || isString(specTheme))) ||
(isString(specTheme) && (!optionTheme || isString(optionTheme)))
) {
const finalTheme = mergeTheme(
{},
getThemeObject(this._currentThemeName),
getThemeObject(optionTheme),
getThemeObject(specTheme)
);

this._currentTheme = processThemeByChartType(chartType, finalTheme);
} else {
const finalTheme = mergeTheme(
{},
getThemeObject(this._currentThemeName),
getThemeObject(optionTheme),
getThemeObject(specTheme)
);
this._currentTheme = processThemeByChartType(chartType, finalTheme);
}
const finalTheme = mergeTheme(
{},
getThemeObject(
isObject(specTheme) && specTheme.type
? specTheme.type
: isObject(optionTheme) && optionTheme.type
? optionTheme.type
: this._currentThemeName
),
getThemeObject(optionTheme),
getThemeObject(specTheme)
);
this._currentTheme = processThemeByChartType(chartType, finalTheme);
} else {
currentTheme = getThemeObject(this._currentThemeName);
this._currentTheme = processThemeByChartType(chartType, currentTheme);
Expand Down
Loading