Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c23b69a

Browse files
authored
Merge pull request plotly#3891 from plotly/fix3871-pie-legend-color
fix pie-like legend when line color array has length greater than 3
2 parents 6e2da35 + da77d21 commit c23b69a

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

src/components/legend/style.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,13 @@ module.exports = function style(s, gd) {
461461
if(pts.size()) {
462462
var cont = (trace.marker || {}).line;
463463
var lw = boundLineWidth(pieCastOption(cont.width, d0.pts), cont, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH);
464+
464465
var tMod = Lib.minExtend(trace, {marker: {line: {width: lw}}});
466+
// since minExtend do not slice more than 3 items we need to patch line.color here
467+
tMod.marker.line.color = cont.color;
468+
465469
var d0Mod = Lib.minExtend(d0, {trace: tMod});
470+
466471
stylePie(pts, d0Mod, tMod);
467472
}
468473
}
83 Bytes
Loading
Loading
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"data": [
3+
{
4+
"type": "pie",
5+
"labels": [
6+
"a",
7+
"b",
8+
"c",
9+
"yellow"
10+
],
11+
"values": [
12+
1,
13+
3,
14+
5,
15+
7
16+
],
17+
"marker": {
18+
"colors": [
19+
"pink",
20+
"lightgreen",
21+
"skyblue",
22+
"orange"
23+
],
24+
"line": {
25+
"width": 5,
26+
"color": [
27+
"red",
28+
"green",
29+
"blue",
30+
"yellow"
31+
]
32+
}
33+
}
34+
}
35+
],
36+
"layout": {
37+
"width": 400,
38+
"height": 400,
39+
"title": { "text": "pie-like legend with line.color array of length > 3" }
40+
}
41+
}

0 commit comments

Comments
 (0)