Skip to content

Commit 11aed69

Browse files
authored
Merge pull request #5224 from apexcharts/fix/pie-stroke-colors-cycle
fix(pie): cycle stroke.colors across slices instead of indexing off t…
2 parents 25c8202 + f101aec commit 11aed69

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/charts/Pie.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,15 @@ class Pie {
303303

304304
const elPath = graphics.drawPath({
305305
d: path,
306+
// Pie/donut/polarArea data is a single series, so a user-supplied
307+
// `stroke.colors` shorter than the slice count is NOT padded by the
308+
// theme engine (unlike fill colors, which cycle). Without this, only
309+
// slice 0 gets the requested color and the rest fall back to a grey
310+
// default. Cycle the array — matching fill-color behaviour — so a
311+
// single `stroke.colors: ['#fff']` borders every slice as expected.
306312
stroke: Array.isArray(this.lineColorArr)
307-
? this.lineColorArr[i]
313+
? this.lineColorArr[i] ??
314+
this.lineColorArr[i % this.lineColorArr.length]
308315
: this.lineColorArr,
309316
strokeWidth: 0,
310317
fill: pathFill,

0 commit comments

Comments
 (0)