Skip to content

Commit

Permalink
fix: 解决 width 、height 单一设置无效问题 (#1490)
Browse files Browse the repository at this point in the history
Co-authored-by: liufu.lf <liufu.lf@antfin.com>
  • Loading branch information
lxfu1 and liufu.lf authored Aug 26, 2020
1 parent c660d8f commit 263caf5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/core/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ export abstract class Plot<O extends PickOptions> extends EE {
}

/**
* 计算默认的 chart 大小。逻辑简化:如果存在 width height,则直接使用,否则使用容器大小
* 计算默认的 chart 大小。逻辑简化:如果存在 width height,则直接使用,否则使用容器大小
* @param width
* @param height
* @param autoFit
*/
private getChartSize(width: number, height: number, autoFit: boolean): Size {
if (width && height) {
return { width, height };
}

return { width, height, ...getContainerSize(this.container) };
const chartSize = getContainerSize(this.container);
return { width: width || chartSize.width, height: height || chartSize.height };
}

/**
Expand Down

0 comments on commit 263caf5

Please sign in to comment.