Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sankey): add itemStyle.borderRadius option for sankey series #19763

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.