Skip to content

Commit

Permalink
fix: axis title visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
paleface001 committed Nov 19, 2019
1 parent d10dfb5 commit 794ae0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
24 changes: 10 additions & 14 deletions src/components/axis/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ export default class AxisParser {
this._isVisible('grid') ? this._gridParser() : (this.config.grid = null);
this._isVisible('tickLine') ? this._tickLineParser() : (this.config.tickLine = null);
this._isVisible('label') ? this._labelParser() : (this.config.label = null);
if (this.localProps.title) {
this._titleParser();
}
this._isVisible('title') ? this._titleParser() : (this.config.title = null);

propertyMapping(this.localProps, this.config, 'autoHideLabel');
propertyMapping(this.localProps, this.config, 'autoRotateLabel');
propertyMapping(this.localProps, this.config, 'autoRotateTitle');
Expand Down Expand Up @@ -118,22 +117,19 @@ export default class AxisParser {
private _titleParser() {
const titleConfig: DataPointType = { ...this.localProps.title };
const { visible, style, text } = this.localProps.title;

if (!visible) {
this.config.showTitle = false;
} else {
this.config.showTitle = true;
if (style) {
titleConfig.textStyle = style;
}
titleConfig.textStyle = _.deepMix({}, _.get(this.config, 'title.style'), titleConfig.textStyle);

if (text) {
titleConfig.text = text;
}
}

if (style) {
titleConfig.textStyle = style;
}
titleConfig.textStyle = _.deepMix({}, _.get(this.config, 'title.style'), titleConfig.textStyle);

if (text) {
titleConfig.text = text;
}

this.config.title = titleConfig;
}

Expand Down
1 change: 0 additions & 1 deletion src/plots/stack-area/component/label/area-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class AreaLabel extends ElementLabels {
private scaleFactor: number[] = [];

public showLabels(points: any, shapes: Shape[]) {
console.log(this.get('labelOptions'));
// 获取堆叠字段
const stackField = this.get('element').get('attrs').color.scales[0].field;
// 根据stackField将point分组
Expand Down

0 comments on commit 794ae0e

Please sign in to comment.