Skip to content

Commit ac22cd3

Browse files
committed
do not compute axis scale when not needed
1 parent a028e10 commit ac22cd3

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/plots/gl3d/scene.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -726,24 +726,26 @@ proto.plot = function(sceneData, fullLayout, layout) {
726726
}
727727

728728
var aspectmode = fullSceneLayout.aspectmode;
729-
730-
var axesScaleRatio = [1, 1, 1];
731-
732-
// Compute axis scale per category
733-
for(i = 0; i < 3; ++i) {
734-
axis = fullSceneLayout[axisProperties[i]];
735-
axisType = axis.type;
736-
var axisRatio = axisTypeRatios[axisType];
737-
axesScaleRatio[i] = Math.pow(axisRatio.acc, 1.0 / axisRatio.count) / dataScale[i];
729+
var axesScaleRatio;
730+
if(aspectmode === 'auto' || aspectmode === 'data') {
731+
axesScaleRatio = [1, 1, 1];
732+
733+
// Compute axis scale per category
734+
for(i = 0; i < 3; ++i) {
735+
axis = fullSceneLayout[axisProperties[i]];
736+
axisType = axis.type;
737+
var axisRatio = axisTypeRatios[axisType];
738+
axesScaleRatio[i] = Math.pow(axisRatio.acc, 1.0 / axisRatio.count) / dataScale[i];
739+
}
738740
}
739741

740742
/*
741743
* Dynamically set the aspect ratio depending on the users aspect settings
742744
*/
743-
var axisAutoScaleFactor = 4;
744745
var aspectRatio;
745-
746746
if(aspectmode === 'auto') {
747+
var axisAutoScaleFactor = 4;
748+
747749
if(Math.max.apply(null, axesScaleRatio) / Math.min.apply(null, axesScaleRatio) <= axisAutoScaleFactor) {
748750
/*
749751
* USE DATA MODE WHEN AXIS RANGE DIMENSIONS ARE RELATIVELY EQUAL

0 commit comments

Comments
 (0)