Skip to content

Commit a98a123

Browse files
committed
plots: use trace gd.data index to determine dflt trace name
- ... instead of gd._fullData index - so that e.g. traces following one-to-many transform are listed as trace 1, ...
1 parent e1d440d commit a98a123

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plots/plots.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
612612

613613
for(var i = 0; i < dataIn.length; i++) {
614614
var trace = dataIn[i],
615-
fullTrace = plots.supplyTraceDefaults(trace, cnt, fullLayout);
615+
fullTrace = plots.supplyTraceDefaults(trace, cnt, fullLayout, i);
616616

617617
fullTrace.index = i;
618618
fullTrace._input = trace;
@@ -623,7 +623,7 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
623623

624624
for(var j = 0; j < expandedTraces.length; j++) {
625625
var expandedTrace = expandedTraces[j],
626-
fullExpandedTrace = plots.supplyTraceDefaults(expandedTrace, cnt, fullLayout);
626+
fullExpandedTrace = plots.supplyTraceDefaults(expandedTrace, cnt, fullLayout, i);
627627

628628
// mutate uid here using parent uid and expanded index
629629
// to promote consistency between update calls
@@ -722,9 +722,9 @@ plots.supplyFrameDefaults = function(frameIn) {
722722
return frameOut;
723723
};
724724

725-
plots.supplyTraceDefaults = function(traceIn, traceIndex, layout) {
725+
plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInIndex) {
726726
var traceOut = {},
727-
defaultColor = Color.defaults[traceIndex % Color.defaults.length];
727+
defaultColor = Color.defaults[traceOutIndex % Color.defaults.length];
728728

729729
function coerce(attr, dflt) {
730730
return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt);
@@ -741,7 +741,7 @@ plots.supplyTraceDefaults = function(traceIn, traceIndex, layout) {
741741

742742
coerce('type');
743743
coerce('uid');
744-
coerce('name', 'trace ' + traceIndex);
744+
coerce('name', 'trace ' + traceInIndex);
745745

746746
// coerce subplot attributes of all registered subplot types
747747
var subplotTypes = Object.keys(subplotsRegistry);

0 commit comments

Comments
 (0)