Skip to content

Commit

Permalink
Merge pull request #19763 from deftliang/fix-sankey-radius
Browse files Browse the repository at this point in the history
feat(sankey): Add sankey chart itemStyle.borderRadius support.
  • Loading branch information
Ovilia authored May 9, 2024
2 parents 7e4c703 + 29c0f9d commit 75dd430
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 75dd430

Please sign in to comment.