Skip to content

Commit

Permalink
fix: fix getCurrentSize() of vchart
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Dec 27, 2023
1 parent dfa9e56 commit e9dc25b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/vchart/src/core/vchart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,7 @@ export class VChart implements IVChart {
this._currentThemeName = ThemeManager.getCurrentThemeName();
this._setNewSpec(spec);
this._updateCurrentTheme();
this._currentSize = calculateChartSize(this._spec, {
container: this._container,
canvas: this._canvas,
mode: this._option.mode || RenderModeEnum['desktop-browser'],
modeParams: this._option.modeParams
});
this._currentSize = this.getCurrentSize();
this._compiler = new Compiler(
{
dom: this._container ?? 'none',
Expand Down Expand Up @@ -545,12 +540,12 @@ export class VChart implements IVChart {
}

getCurrentSize() {
const { width: containerWidth, height: containerHeight } = getContainerSize(
this._container!,
DEFAULT_CHART_WIDTH,
DEFAULT_CHART_HEIGHT
);
return { width: this._spec.width ?? containerWidth, height: this._spec.height ?? containerHeight };
return calculateChartSize(this._spec, {
container: this._container,
canvas: this._canvas,
mode: this._option.mode || RenderModeEnum['desktop-browser'],
modeParams: this._option.modeParams
});
}

private _doResize() {
Expand Down

0 comments on commit e9dc25b

Please sign in to comment.