From 29c0f9df11ee68e745ddf2bf3b82070f43bf93fe Mon Sep 17 00:00:00 2001 From: deft Date: Wed, 27 Mar 2024 11:58:12 +0800 Subject: [PATCH] feat(sankey): Add sankey chart itemStyle.borderRadius support. --- src/chart/sankey/SankeyView.ts | 6 ++- src/util/types.ts | 1 + test/sankey-borderRadius.html | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 test/sankey-borderRadius.html diff --git a/src/chart/sankey/SankeyView.ts b/src/chart/sankey/SankeyView.ts index 70b264d53e..e84b7f7ee8 100644 --- a/src/chart/sankey/SankeyView.ts +++ b/src/chart/sankey/SankeyView.ts @@ -259,13 +259,15 @@ class SankeyView extends ChartView { const dragX = itemModel.get('localX'); const dragY = itemModel.get('localY'); const emphasisModel = itemModel.getModel('emphasis'); + const borderRadius = itemModel.get(['itemStyle', 'borderRadius']) as number | number[] || 0; const rect = new graphic.Rect({ shape: { x: dragX != null ? dragX * width : layout.x, y: dragY != null ? dragY * height : layout.y, width: layout.dx, - height: layout.dy + height: layout.dy, + r: borderRadius }, style: itemModel.getModel('itemStyle').getItemStyle(), z2: 10 @@ -387,7 +389,7 @@ function createGridClipShape(rect: RectLike, seriesModel: SankeySeriesModel, cb: x: rect.x - 10, y: rect.y - 10, width: 0, - height: rect.height + 20 + height: rect.height + 20, } }); graphic.initProps(rectEl, { diff --git a/src/util/types.ts b/src/util/types.ts index 01e9321888..8fd9435013 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -925,6 +925,7 @@ export interface ItemStyleOption extends ShadowOptionMixin, B color?: ZRColor | (TCbParams extends never ? never : ((params: TCbParams) => ZRColor)) opacity?: number decal?: DecalObject | 'none' + borderRadius?: (number | string)[] | number | string } /** diff --git a/test/sankey-borderRadius.html b/test/sankey-borderRadius.html new file mode 100644 index 0000000000..8672578422 --- /dev/null +++ b/test/sankey-borderRadius.html @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +