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

Function getBounds

src/components/shapes/draw.js:261–279  ·  view source on GitHub ↗
(refs, isVertical)

Source from the content-addressed store, hash-verified

259 const gs = gd._fullLayout._size;
260
261 function getBounds(refs, isVertical) {
262 // Retrieve all existing axes from the references
263 const axes = (Array.isArray(refs) ? refs : [refs]).map((r) => Axes.getFromId(gd, r)).filter(Boolean);
264
265 // If no valid axes, return the bounds of the larger plot area
266 if (!axes.length) {
267 return isVertical ? [gs.t, gs.t + gs.h] : [gs.l, gs.l + gs.w];
268 }
269
270 // Otherwise, we find all find and return the smallest start point
271 // and largest end point to be used as the clip bounds
272 const startBounds = axes.map(function (ax) {
273 return ax._offset;
274 });
275 const endBounds = axes.map(function (ax) {
276 return ax._offset + ax._length;
277 });
278 return [Math.min(...startBounds), Math.max(...endBounds)];
279 }
280
281 const xb = getBounds(xref, false);
282 const yb = getBounds(yref, true);

Callers 1

getMultiAxisClipRectFunction · 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…