Skip to content

Commit acafe63

Browse files
committed
fix assignment of text in pie.calc
1 parent a238ee1 commit acafe63

File tree

1 file changed

+11
-8
lines changed
  • shelly/plotlyjs/static/plotlyjs/src

1 file changed

+11
-8
lines changed

shelly/plotlyjs/static/plotlyjs/src/pie.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ pie.calc = function(gd, trace) {
258258
v,
259259
label,
260260
color,
261-
hidden;
261+
hidden,
262+
pt;
262263

263264
if(trace.dlabel) {
264265
labels = new Array(vals.length);
@@ -319,8 +320,9 @@ pie.calc = function(gd, trace) {
319320

320321
if(needDefaults) {
321322
for(i = 0; i < cd.length; i++) {
322-
if(cd[i].color === false) {
323-
colorMap[cd[i].label] = cd[i].color = nextDefaultColor(fullLayout._piedefaultcolorcount);
323+
pt = cd[i];
324+
if(pt.color === false) {
325+
colorMap[pt.label] = pt.color = nextDefaultColor(fullLayout._piedefaultcolorcount);
324326
fullLayout._piedefaultcolorcount++;
325327
}
326328
}
@@ -338,11 +340,12 @@ pie.calc = function(gd, trace) {
338340
thisText;
339341

340342
for(i = 0; i < cd.length; i++) {
341-
thisText = hasLabel ? [cd[i].label] : [];
342-
if(hasText && trace.text[i]) thisText.push(trace.text[i]);
343-
if(hasValue) thisText.push(formatPieValue(cd[i].v));
344-
if(hasPercent) thisText.push(formatPiePercent(cd[i].v / vTotal));
345-
cd[i].text = thisText.join('<br>');
343+
pt = cd[i];
344+
thisText = hasLabel ? [pt.label] : [];
345+
if(hasText && trace.text[pt.i]) thisText.push(trace.text[pt.i]);
346+
if(hasValue) thisText.push(formatPieValue(pt.v));
347+
if(hasPercent) thisText.push(formatPiePercent(pt.v / vTotal));
348+
pt.text = thisText.join('<br>');
346349
}
347350
}
348351

0 commit comments

Comments
 (0)