Skip to content

Commit 0e29c54

Browse files
authored
Merge pull request #4512 from VisActor/fix/theme-config-type
Fix/theme config type
2 parents 4a48534 + 7632f9b commit 0e29c54

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "fix: fix theme config of spec and option\n\n",
5+
"type": "none",
6+
"packageName": "@visactor/vchart"
7+
}
8+
],
9+
"packageName": "@visactor/vchart",
10+
"email": "dingling112@gmail.com"
11+
}

packages/vchart/src/core/vchart.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,27 +1471,19 @@ export class VChart implements IVChart {
14711471
// 处理 specTheme 和 optionTheme, merge -> transform
14721472
// 优先级 currentTheme < optionTheme < specTheme
14731473
if (!isEmpty(optionTheme) || !isEmpty(specTheme)) {
1474-
if (
1475-
(isString(optionTheme) && (!specTheme || isString(specTheme))) ||
1476-
(isString(specTheme) && (!optionTheme || isString(optionTheme)))
1477-
) {
1478-
const finalTheme = mergeTheme(
1479-
{},
1480-
getThemeObject(this._currentThemeName),
1481-
getThemeObject(optionTheme),
1482-
getThemeObject(specTheme)
1483-
);
1484-
1485-
this._currentTheme = processThemeByChartType(chartType, finalTheme);
1486-
} else {
1487-
const finalTheme = mergeTheme(
1488-
{},
1489-
getThemeObject(this._currentThemeName),
1490-
getThemeObject(optionTheme),
1491-
getThemeObject(specTheme)
1492-
);
1493-
this._currentTheme = processThemeByChartType(chartType, finalTheme);
1494-
}
1474+
const finalTheme = mergeTheme(
1475+
{},
1476+
getThemeObject(
1477+
isObject(specTheme) && specTheme.type
1478+
? specTheme.type
1479+
: isObject(optionTheme) && optionTheme.type
1480+
? optionTheme.type
1481+
: this._currentThemeName
1482+
),
1483+
getThemeObject(optionTheme),
1484+
getThemeObject(specTheme)
1485+
);
1486+
this._currentTheme = processThemeByChartType(chartType, finalTheme);
14951487
} else {
14961488
currentTheme = getThemeObject(this._currentThemeName);
14971489
this._currentTheme = processThemeByChartType(chartType, currentTheme);

0 commit comments

Comments
 (0)