Skip to content

Commit

Permalink
Merge pull request #1851 from VisActor/fix/get-current-size
Browse files Browse the repository at this point in the history
fix: fix `getCurrentSize()` of vchart
  • Loading branch information
xile611 authored Dec 27, 2023
2 parents dfa9e56 + e9dc25b commit 49c2b57
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 49c2b57

Please sign in to comment.