g.js — graphical objects for JavaScript

boundsbounds

Get the bounds of a shape.

g.bounds(g.ellipse({x:0, y:0}, 50, 50));

You can use lookup to retrieve a specific component, e.g. the width:

var b = g.bounds(g.ellipse({x:0, y:0}, 50, 50));
g.lookup(b, 'width');

Parameters

  • shape: The input shape.