Skip to content

Commit 876692a

Browse files
authored
Merge pull request #3545 from VisActor/feat/area-insideMiddle-label
feat: support inside-middle label position in area chart
2 parents 551def1 + 50a3296 commit 876692a

File tree

14 files changed

+183
-164
lines changed

14 files changed

+183
-164
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 117 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/option/en/series/area.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Optional string values:
124124
- `'bottom-right'`
125125
- `'bottom-left'`
126126
- `'center'`
127+
- `'inside-middle'` ( Supported since `1.13.1`
127128

128129
{{ use: component-label(
129130
prefix = '#' + ${prefix},

docs/assets/option/zh/series/area.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ label: {
124124
- `'bottom-right'`
125125
- `'bottom-left'`
126126
- `'center'`
127+
- `'inside-middle'``1.13.1` 版本开始支持)
127128

128129
{{ use: component-label(
129130
prefix = '#' + ${prefix},

docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"@visactor/vchart-theme": "~1.6.6",
2020
"@visactor/vmind": "1.2.4-alpha.5",
2121
"@visactor/vutils": "~0.19.2",
22-
"@visactor/vrender": "0.21.1",
23-
"@visactor/vrender-kits": "0.21.1",
24-
"@visactor/vgrammar": "0.15.0",
22+
"@visactor/vrender": "0.21.2",
23+
"@visactor/vrender-kits": "0.21.2",
24+
"@visactor/vgrammar": "0.15.1",
2525
"@visactor/vtable": "1.12.0",
2626
"@visactor/vtable-editors": "1.12.0",
2727
"@visactor/vtable-gantt": "1.12.0",
@@ -59,4 +59,4 @@
5959
"react-device-detect": "^2.2.2",
6060
"minimist": "1.2.8"
6161
}
62-
}
62+
}

packages/openinula-vchart/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"dependencies": {
3131
"@visactor/vchart": "workspace:1.13.0",
3232
"@visactor/vutils": "~0.19.2",
33-
"@visactor/vrender-core": "0.21.1",
34-
"@visactor/vrender-kits": "0.21.1",
35-
"@visactor/vgrammar-core": "0.15.0",
33+
"@visactor/vrender-core": "0.21.2",
34+
"@visactor/vrender-kits": "0.21.2",
35+
"@visactor/vgrammar-core": "0.15.1",
3636
"react-is": "^18.2.0"
3737
},
3838
"devDependencies": {
@@ -79,4 +79,4 @@
7979
"access": "public",
8080
"registry": "https://registry.npmjs.org/"
8181
}
82-
}
82+
}

packages/react-vchart/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"dependencies": {
3131
"@visactor/vchart": "workspace:1.13.0",
3232
"@visactor/vutils": "~0.19.2",
33-
"@visactor/vrender-core": "0.21.1",
34-
"@visactor/vrender-kits": "0.21.1",
35-
"@visactor/vgrammar-core": "0.15.0",
33+
"@visactor/vrender-core": "0.21.2",
34+
"@visactor/vrender-kits": "0.21.2",
35+
"@visactor/vgrammar-core": "0.15.1",
3636
"react-is": "^18.2.0"
3737
},
3838
"devDependencies": {
@@ -83,4 +83,4 @@
8383
"access": "public",
8484
"registry": "https://registry.npmjs.org/"
8585
}
86-
}
86+
}

packages/vchart-extension/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"start": "ts-node __tests__/runtime/browser/scripts/initVite.ts && vite serve __tests__/runtime/browser"
2222
},
2323
"dependencies": {
24-
"@visactor/vrender-core": "0.21.1",
25-
"@visactor/vrender-kits": "0.21.1",
26-
"@visactor/vrender-components": "0.21.1",
27-
"@visactor/vgrammar-core": "0.15.0",
24+
"@visactor/vrender-core": "0.21.2",
25+
"@visactor/vrender-kits": "0.21.2",
26+
"@visactor/vrender-components": "0.21.2",
27+
"@visactor/vgrammar-core": "0.15.1",
2828
"@visactor/vutils": "~0.19.2",
2929
"@visactor/vdataset": "~0.19.2",
3030
"@visactor/vchart": "workspace:1.13.0"
@@ -60,4 +60,4 @@
6060
"registry": "https://registry.npmjs.org/"
6161
},
6262
"license": "MIT"
63-
}
63+
}

packages/vchart/CHANGELOG.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"comment": "feat: support max height of tooltip, by percent value , close #2675\n\n"
1818
},
1919
{
20-
"comment": "fix: upgrade vrender to 0.21.1, vgrammar to 0.15.0\n\n"
20+
"comment": "fix: upgrade vrender to 0.21.2, vgrammar to 0.15.1\n\n"
2121
}
2222
]
2323
}
@@ -3489,4 +3489,4 @@
34893489
}
34903490
}
34913491
]
3492-
}
3492+
}

packages/vchart/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@
120120
"@visactor/vutils": "~0.19.2",
121121
"@visactor/vdataset": "~0.19.2",
122122
"@visactor/vscale": "~0.19.2",
123-
"@visactor/vrender-core": "0.21.1",
124-
"@visactor/vrender-kits": "0.21.1",
125-
"@visactor/vrender-components": "0.21.1",
126-
"@visactor/vgrammar-core": "0.15.0",
127-
"@visactor/vgrammar-projection": "0.15.0",
128-
"@visactor/vgrammar-wordcloud": "0.15.0",
129-
"@visactor/vgrammar-wordcloud-shape": "0.15.0",
130-
"@visactor/vgrammar-hierarchy": "0.15.0",
131-
"@visactor/vgrammar-sankey": "0.15.0",
132-
"@visactor/vgrammar-venn": "0.15.0",
133-
"@visactor/vgrammar-util": "0.15.0",
123+
"@visactor/vrender-core": "0.21.2",
124+
"@visactor/vrender-kits": "0.21.2",
125+
"@visactor/vrender-components": "0.21.2",
126+
"@visactor/vgrammar-core": "0.15.1",
127+
"@visactor/vgrammar-projection": "0.15.1",
128+
"@visactor/vgrammar-wordcloud": "0.15.1",
129+
"@visactor/vgrammar-wordcloud-shape": "0.15.1",
130+
"@visactor/vgrammar-hierarchy": "0.15.1",
131+
"@visactor/vgrammar-sankey": "0.15.1",
132+
"@visactor/vgrammar-venn": "0.15.1",
133+
"@visactor/vgrammar-util": "0.15.1",
134134
"@visactor/vutils-extension": "workspace:1.13.0"
135135
},
136136
"publishConfig": {
137137
"access": "public",
138138
"registry": "https://registry.npmjs.org/"
139139
}
140-
}
140+
}

packages/vchart/src/series/area/area-transformer.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ export class AreaSeriesSpecTransformer<
1414
protected _supportStack: boolean = true;
1515

1616
protected _transformLabelSpec(spec: T): void {
17-
super._transformLabelSpec(spec);
17+
const isPointVisible = spec.point?.visible !== false && spec.point?.style?.visible !== false;
18+
19+
this._addMarkLabelSpec(spec, (spec: any) => {
20+
const isAreaMiddle = spec.position === 'inside-middle';
21+
return !isPointVisible || isAreaMiddle ? SeriesMarkNameEnum.area : SeriesMarkNameEnum.point;
22+
});
23+
1824
this._addMarkLabelSpec<AreaSeries>(
1925
spec,
2026
SeriesMarkNameEnum.area,
@@ -23,10 +29,6 @@ export class AreaSeriesSpecTransformer<
2329
undefined,
2430
true
2531
);
26-
const isPointVisible = spec.point?.visible !== false && spec.point?.style?.visible !== false;
27-
if (!isPointVisible) {
28-
this._addMarkLabelSpec(spec, SeriesMarkNameEnum.area);
29-
}
3032
}
3133

3234
protected _transformSpecAfterMergingTheme(spec: T, chartSpec: any, chartSpecInfo?: IChartSpecInfo) {

0 commit comments

Comments
 (0)