Skip to content

Commit

Permalink
feat: support bar background borderRadius
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Mar 6, 2023
1 parent 5667432 commit dca62c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/chart/bar/BarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ class BarView extends ChartView {
if (coord.type === 'cartesian2d') {
(bgEl as Rect).setShape('r', barBorderRadius);
}
else {
(bgEl as Sector).setShape('cornerRadius', barBorderRadius);
}
bgEls[dataIndex] = bgEl;
return bgEl;
};
Expand Down Expand Up @@ -337,6 +340,9 @@ class BarView extends ChartView {
if (coord.type === 'cartesian2d') {
(bgEl as Rect).setShape('r', barBorderRadius);
}
else {
(bgEl as Sector).setShape('cornerRadius', barBorderRadius);
}
bgEls[newIndex] = bgEl;
}
const bgLayout = getLayout[coord.type](data, newIndex);
Expand Down Expand Up @@ -990,15 +996,14 @@ function updateStyle(
(el as Rect).setShape('r', borderRadius);
}
else if (!seriesModel.get('roundCap')) {
const sector = el as Sector;
const sectorShape = (el as Sector).shape;
const cornerRadius = getSectorCornerRadius(
itemModel.getModel('itemStyle'),
sectorShape,
true
);
extend(sectorShape, cornerRadius);
sector.setShape(sectorShape);
(el as Sector).setShape(sectorShape);
}

el.useStyle(style);
Expand Down
12 changes: 12 additions & 0 deletions test/bar-polar-borderRadius.html

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

0 comments on commit dca62c9

Please sign in to comment.