MCPcopy Index your code
hub / github.com/plotly/plotly.js / handleAxisDefaults

Function handleAxisDefaults

src/traces/splom/defaults.js:70–170  ·  view source on GitHub ↗
(traceIn, traceOut, layout, coerce)

Source from the content-addressed store, hash-verified

68}
69
70function handleAxisDefaults(traceIn, traceOut, layout, coerce) {
71 var dimensions = traceOut.dimensions;
72 var dimLength = dimensions.length;
73 var showUpper = traceOut.showupperhalf;
74 var showLower = traceOut.showlowerhalf;
75 var showDiag = traceOut.diagonal.visible;
76 var i, j;
77
78 var xAxesDflt = new Array(dimLength);
79 var yAxesDflt = new Array(dimLength);
80
81 for (i = 0; i < dimLength; i++) {
82 var suffix = i ? i + 1 : '';
83 xAxesDflt[i] = 'x' + suffix;
84 yAxesDflt[i] = 'y' + suffix;
85 }
86
87 var xaxes = coerce('xaxes', xAxesDflt);
88 var yaxes = coerce('yaxes', yAxesDflt);
89
90 // build list of [x,y] axis corresponding to each dimensions[i],
91 // very useful for passing options to regl-splom
92 var diag = (traceOut._diag = new Array(dimLength));
93
94 // lookup for 'drawn' x|y axes, to avoid costly indexOf downstream
95 traceOut._xaxes = {};
96 traceOut._yaxes = {};
97
98 // list of 'drawn' x|y axes, use to generate list of subplots
99 var xList = [];
100 var yList = [];
101
102 function fillAxisStashes(axId, counterAxId, dim, list) {
103 if (!axId) return;
104
105 var axLetter = axId.charAt(0);
106 var stash = layout._splomAxes[axLetter];
107
108 traceOut['_' + axLetter + 'axes'][axId] = 1;
109 list.push(axId);
110
111 if (!(axId in stash)) {
112 var s = (stash[axId] = {});
113 if (dim) {
114 s.label = dim.label || '';
115 if (dim.visible && dim.axis) {
116 if (dim.axis.type) s.type = dim.axis.type;
117 if (dim.axis.matches) s.matches = counterAxId;
118 }
119 }
120 }
121 }
122
123 // cases where showDiag and showLower or showUpper are false
124 // no special treatment as the 'drawn' x-axes and y-axes no longer match
125 // the dimensions items and xaxes|yaxes 1-to-1
126 var mustShiftX = !showDiag && !showLower;
127 var mustShiftY = !showDiag && !showUpper;

Callers 4

defaults.jsFile · 0.70
mockColorBarAxisFunction · 0.50
mimickAxisDefaultsFunction · 0.50
mockAxisFunction · 0.50

Calls 2

fillAxisStashesFunction · 0.85
coerceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…