How to use the @antv/g.BBox.fromRange function in @antv/g

To help you get started, we’ve selected a few @antv/g examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / packages / component / src / annotation / data-region.ts View on Github external
private getBBox(data: Point[]) {
    const xs = [];
    const ys = [];
    for (let i = 0; i < data.length; i++) {
      xs.push(data[i].x);
      ys.push(data[i].y);
    }
    const xRange = _.getRange(xs);
    const yRange = _.getRange(ys);

    return BBox.fromRange(xRange.min, yRange.min, xRange.max, yRange.max);
  }
}