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

Function updateSubplots

src/plots/cartesian/dragbox.js:872–1008  ·  view source on GitHub ↗
(viewBox)

Source from the content-addressed store, hash-verified

870 // sharing an affected axis (including the one being dragged),
871 // includes also scattergl and splom logic.
872 function updateSubplots(viewBox) {
873 var fullLayout = gd._fullLayout;
874 var plotinfos = fullLayout._plots;
875 var subplots = fullLayout._subplots.cartesian;
876 var i, sp, xa, ya;
877
878 if(hasSplom) {
879 Registry.subplotsRegistry.splom.drag(gd);
880 }
881
882 if(hasScatterGl) {
883 for(i = 0; i < subplots.length; i++) {
884 sp = plotinfos[subplots[i]];
885 xa = sp.xaxis;
886 ya = sp.yaxis;
887
888 if(sp._scene) {
889 if(xa.limitRange) xa.limitRange();
890 if(ya.limitRange) ya.limitRange();
891
892 var xrng = Lib.simpleMap(xa.range, xa.r2l);
893 var yrng = Lib.simpleMap(ya.range, ya.r2l);
894
895 sp._scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]});
896 }
897 }
898 }
899
900 if(hasSplom || hasScatterGl) {
901 clearGlCanvases(gd);
902 redrawReglTraces(gd);
903 }
904
905 if(hasSVG) {
906 var xScaleFactor = viewBox[2] / xa0._length;
907 var yScaleFactor = viewBox[3] / ya0._length;
908
909 for(i = 0; i < subplots.length; i++) {
910 sp = plotinfos[subplots[i]];
911 xa = sp.xaxis;
912 ya = sp.yaxis;
913
914 var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id];
915 var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id];
916
917 var xScaleFactor2, yScaleFactor2;
918 var clipDx, clipDy;
919
920 if(editX2) {
921 xScaleFactor2 = xScaleFactor;
922 clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2);
923 } else if(matches.xaHash[xa._id]) {
924 xScaleFactor2 = xScaleFactor;
925 clipDx = viewBox[0] * xa._length / xa0._length;
926 } else if(matches.yaHash[xa._id]) {
927 xScaleFactor2 = yScaleFactor;
928 clipDx = yActive === 'ns' ?
929 -viewBox[1] * xa._length / ya0._length :

Callers 4

makeDragBoxFunction · 0.85
zoomWheelFunction · 0.85
plotDragFunction · 0.85
dragTailFunction · 0.85

Calls 3

getShiftFunction · 0.85
getLinkedScaleFactorFunction · 0.85
scaleAndGetShiftFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…