Skip to content

Commit

Permalink
feat(sankey): Add sankey chart itemStyle.borderRadius support.
Browse files Browse the repository at this point in the history
  • Loading branch information
deft-v committed Mar 27, 2024
1 parent c576f0c commit 29c0f9d
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/chart/sankey/SankeyView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, {
Expand Down
1 change: 1 addition & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ export interface ItemStyleOption<TCbParams = never> extends ShadowOptionMixin, B
color?: ZRColor | (TCbParams extends never ? never : ((params: TCbParams) => ZRColor))
opacity?: number
decal?: DecalObject | 'none'
borderRadius?: (number | string)[] | number | string
}

/**
Expand Down
93 changes: 93 additions & 0 deletions test/sankey-borderRadius.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29c0f9d

Please sign in to comment.