Skip to content

Commit 0ca45f0

Browse files
committed
fix issue 3871 - pie-like legend with line color array
1 parent 93af5d6 commit 0ca45f0

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

src/lib/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ lib.getTargetArray = function(trace, transformOpts) {
634634
lib.minExtend = function(obj1, obj2) {
635635
var objOut = {};
636636
if(typeof obj2 !== 'object') obj2 = {};
637-
var arrayLen = 3;
638637
var keys = Object.keys(obj1);
639638
var i, k, v;
640639

@@ -644,11 +643,7 @@ lib.minExtend = function(obj1, obj2) {
644643
if(k.charAt(0) === '_' || typeof v === 'function') continue;
645644
else if(k === 'module') objOut[k] = v;
646645
else if(Array.isArray(v)) {
647-
if(k === 'colorscale') {
648-
objOut[k] = v.slice();
649-
} else {
650-
objOut[k] = v.slice(0, arrayLen);
651-
}
646+
objOut[k] = v.slice();
652647
} else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]);
653648
else objOut[k] = v;
654649
}
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)