Skip to content

Commit ddc6d71

Browse files
committed
Simplify signature of drawTexts in legend
* Removed unused `i`. * Passed `legendItem` directly.
1 parent ff16df1 commit ddc6d71

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/legend/draw.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ module.exports = function draw(gd) {
122122
return trace.visible === 'legendonly' ? 0.5 : 1;
123123
}
124124
})
125-
.each(function(d, i) {
126-
drawTexts(this, gd, d, i, traces);
125+
.each(function(d) {
126+
drawTexts(gd, this, d[0], traces);
127127
setupTraceToggle(gd, this, d[0]);
128128
});
129129

@@ -312,12 +312,12 @@ module.exports = function draw(gd) {
312312
}
313313
};
314314

315-
function drawTexts(context, gd, d, i, traces) {
315+
function drawTexts(gd, context, legendItem, traces) {
316316
var fullLayout = gd._fullLayout,
317-
trace = d[0].trace,
317+
trace = legendItem.trace,
318318
isPie = Plots.traceIs(trace, 'pie'),
319319
traceIndex = trace.index,
320-
name = isPie ? d[0].label : trace.name;
320+
name = isPie ? legendItem.label : trace.name;
321321

322322
var text = d3.select(context).selectAll('text.legendtext')
323323
.data([0]);

0 commit comments

Comments
 (0)