You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/10/06 03:39:31 UTC
[incubator-echarts] branch next updated: feat(sunburst): sunburst
supports cornerRadius(apache#13123).
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/next by this push:
new f83ee61 feat(sunburst): sunburst supports cornerRadius(apache#13123).
new 51a13cd Merge pull request #13390 from plainheart/feat/sunburst-cornerRadius
f83ee61 is described below
commit f83ee616dbfd190f7bd23274e6c622aba60d1ef1
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Tue Oct 6 01:26:38 2020 +0800
feat(sunburst): sunburst supports cornerRadius(apache#13123).
---
src/chart/sunburst/SunburstSeries.ts | 13 ++++++++++++-
src/chart/sunburst/sunburstLayout.ts | 14 ++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/chart/sunburst/SunburstSeries.ts b/src/chart/sunburst/SunburstSeries.ts
index 20cd920..95fca33 100644
--- a/src/chart/sunburst/SunburstSeries.ts
+++ b/src/chart/sunburst/SunburstSeries.ts
@@ -111,6 +111,16 @@ export interface SunburstSeriesOption extends
animationType?: 'expansion' | 'scale'
sort?: 'desc' | 'asc' | ((a: TreeNode, b: TreeNode) => number)
+
+ // can be 10
+ // which means that both innerCornerRadius and outerCornerRadius are 10
+ // can also be an array [20, 10]
+ // which means that innerCornerRadius is 20
+ // and outerCornerRadius is 10
+ // can also be a string or string array, such as ['20%', '50%']
+ // which means that innerCornerRadius is 20% of the innerRadius
+ // and outerCornerRadius is half of outerRadius.
+ cornerRadius?: (number | string)[] | number | string
}
interface SunburstSeriesModel {
@@ -177,6 +187,7 @@ class SunburstSeriesModel extends SeriesModel<SunburstSeriesOption> {
// 默认全局居中
center: ['50%', '50%'],
radius: [0, '75%'],
+ cornerRadius: 0,
// 默认顺时针
clockwise: true,
startAngle: 90,
@@ -308,4 +319,4 @@ function completeTreeValue(dataNode: SunburstSeriesNodeItemOption) {
SeriesModel.registerClass(SunburstSeriesModel);
-export default SunburstSeriesModel;
\ No newline at end of file
+export default SunburstSeriesModel;
diff --git a/src/chart/sunburst/sunburstLayout.ts b/src/chart/sunburst/sunburstLayout.ts
index f1da06c..0576fb4 100644
--- a/src/chart/sunburst/sunburstLayout.ts
+++ b/src/chart/sunburst/sunburstLayout.ts
@@ -35,6 +35,7 @@ export default function (
ecModel.eachSeriesByType(seriesType, function (seriesModel: SunburstSeriesModel) {
let center = seriesModel.get('center');
let radius = seriesModel.get('radius');
+ let cornerRadius = seriesModel.get('cornerRadius');
if (!zrUtil.isArray(radius)) {
radius = [0, radius];
@@ -42,6 +43,9 @@ export default function (
if (!zrUtil.isArray(center)) {
center = [center, center];
}
+ if (!zrUtil.isArray(cornerRadius)) {
+ cornerRadius = [cornerRadius, cornerRadius];
+ }
const width = api.getWidth();
const height = api.getHeight();
@@ -50,6 +54,8 @@ export default function (
const cy = parsePercent(center[1], height);
const r0 = parsePercent(radius[0], size / 2);
const r = parsePercent(radius[1], size / 2);
+ const innerCornerRadius = parsePercent(cornerRadius[0], r0);
+ const outerCornerRadius = parsePercent(cornerRadius[1], r);
const startAngle = -seriesModel.get('startAngle') * RADIAN;
const minAngle = seriesModel.get('minAngle') * RADIAN;
@@ -139,7 +145,9 @@ export default function (
cx: cx,
cy: cy,
r0: rStart,
- r: rEnd
+ r: rEnd,
+ cornerRadius: outerCornerRadius,
+ innerCornerRadius: innerCornerRadius
});
}
@@ -169,7 +177,9 @@ export default function (
cx: cx,
cy: cy,
r0: rStart,
- r: rEnd
+ r: rEnd,
+ cornerRadius: outerCornerRadius,
+ innerCornerRadius: innerCornerRadius
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org