Skip to content

Commit

Permalink
Merge pull request #240 from antvis/fix-default-widthRatio
Browse files Browse the repository at this point in the history
fix: 在g2plot里设置widthRatio
  • Loading branch information
paleface001 committed Nov 16, 2019
2 parents 28badc2 + 6b56ee8 commit 05fcd2d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/geoms/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export default class ElementParser {
position: {
fields: this.positionFields,
},
widthRatio: {
// 宽度所占的分类的比例
column: 2 / 3, // g2plot定制为2/3
rose: 0.9999999, // 玫瑰图柱状占比 1
multiplePie: 1 / 1.3, // 多层的饼图、环图
},
};
}
}
3 changes: 3 additions & 0 deletions src/interface/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ export interface ElementOption {
animate?: {};
adjust?: AdjustCfg[];
connectNulls?: boolean;
widthRatio?: {
[type: string]: number;
};
}

export interface G2Config {
Expand Down
1 change: 1 addition & 0 deletions src/theme/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const DEFAULT_DARK_THEME = {
backgroundStyle: {
fill: '#262626',
},
defaultColor: '#5B8FF9',
width: 400,
height: 400,
bleeding: [TOP_BLEEDING, 24, 24, 24],
Expand Down
1 change: 1 addition & 0 deletions src/theme/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const TOP_BLEEDING = function(props) {
export const DEFAULT_GLOBAL_THEME = {
width: 400,
height: 400,
defaultColor: '#5B8FF9',
bleeding: [TOP_BLEEDING, 24, 24, 24],
padding: 'auto',
title: {
Expand Down

0 comments on commit 05fcd2d

Please sign in to comment.