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

Function computeTraceBounds

src/plots/gl3d/scene.js:497–533  ·  view source on GitHub ↗
(scene, trace, bounds)

Source from the content-addressed store, hash-verified

495var axisProperties = [ 'xaxis', 'yaxis', 'zaxis' ];
496
497function computeTraceBounds(scene, trace, bounds) {
498 var fullSceneLayout = scene.fullSceneLayout;
499
500 for(var d = 0; d < 3; d++) {
501 var axisName = axisProperties[d];
502 var axLetter = axisName.charAt(0);
503 var ax = fullSceneLayout[axisName];
504 var coords = trace[axLetter];
505 var calendar = trace[axLetter + 'calendar'];
506 var len = trace['_' + axLetter + 'length'];
507
508 if(!Lib.isArrayOrTypedArray(coords)) {
509 bounds[0][d] = Math.min(bounds[0][d], 0);
510 bounds[1][d] = Math.max(bounds[1][d], len - 1);
511 } else {
512 var v;
513
514 for(var i = 0; i < (len || coords.length); i++) {
515 if(Lib.isArrayOrTypedArray(coords[i])) {
516 for(var j = 0; j < coords[i].length; ++j) {
517 v = ax.d2l(coords[i][j], 0, calendar);
518 if(!isNaN(v) && isFinite(v)) {
519 bounds[0][d] = Math.min(bounds[0][d], v);
520 bounds[1][d] = Math.max(bounds[1][d], v);
521 }
522 }
523 } else {
524 v = ax.d2l(coords[i], 0, calendar);
525 if(!isNaN(v) && isFinite(v)) {
526 bounds[0][d] = Math.min(bounds[0][d], v);
527 bounds[1][d] = Math.max(bounds[1][d], v);
528 }
529 }
530 }
531 }
532 }
533}
534
535function computeAnnotationBounds(scene, bounds) {
536 var fullSceneLayout = scene.fullSceneLayout;

Callers 1

scene.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…