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

Function getPosArrays

src/traces/box/calc.js:310–347  ·  view source on GitHub ↗
(trace, posLetter, posAxis, num)

Source from the content-addressed store, hash-verified

308// per trace, set x0 (y0) to the x (y) value or category for this trace
309// (or set x (y) to a constant array matching y (x))
310function getPosArrays(trace, posLetter, posAxis, num) {
311 var hasPosArray = posLetter in trace;
312 var hasPos0 = posLetter + '0' in trace;
313 var hasPosStep = 'd' + posLetter in trace;
314
315 if(hasPosArray || (hasPos0 && hasPosStep)) {
316 var origPos = posAxis.makeCalcdata(trace, posLetter);
317 var pos = alignPeriod(trace, posAxis, posLetter, origPos).vals;
318 return [pos, origPos];
319 }
320
321 var pos0;
322 if(hasPos0) {
323 pos0 = trace[posLetter + '0'];
324 } else if('name' in trace && (
325 posAxis.type === 'category' || (
326 isNumeric(trace.name) &&
327 ['linear', 'log'].indexOf(posAxis.type) !== -1
328 ) || (
329 Lib.isDateTime(trace.name) &&
330 posAxis.type === 'date'
331 )
332 )) {
333 pos0 = trace.name;
334 } else {
335 pos0 = num;
336 }
337
338 var pos0c = posAxis.type === 'multicategory' ?
339 posAxis.r2c_just_indices(pos0) :
340 posAxis.d2c(pos0, 0, trace[posLetter + 'calendar']);
341
342 var len = trace._length;
343 var out = new Array(len);
344 for(var i = 0; i < len; i++) out[i] = pos0c;
345
346 return [out];
347}
348
349function makeBins(x, dx) {
350 var len = x.length;

Callers 1

calc.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…