How to use the @antv/coord/lib/.Rect function in @antv/coord

To help you get started, we’ve selected a few @antv/coord 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 / test / unit / geom / shape / area-spec.js View on Github external
const expect = require('chai').expect;
const { Canvas } = require('../../../../src/renderer');
const Area = require('../../../../src/geom/shape/area');
const Coord = require('@antv/coord/lib/');
// const Global = require('../../../../src/global');

const div = document.createElement('div');
div.id = 'csarea';
document.body.appendChild(div);

let coord = new Coord.Rect({
  start: {
    x: 0,
    y: 500
  },
  end: {
    x: 500,
    y: 0
  }
});

const canvas = new Canvas({
  containerId: 'csarea',
  width: 500,
  height: 500
});
github antvis / G2 / test / unit / geom / shape / shape-spec.js View on Github external
describe('shape register', () => {
  const coord = new Coord.Rect({
    start: {
      x: 0,
      y: 0
    },
    end: {
      x: 200,
      y: 200
    }
  });
  it('get factory null', () => {
    const factory = Shape.getShapeFactory('test');
    expect(factory).equal(undefined);
  });

  it('register factory && register shape', function() {
    let called = false;
github antvis / G2 / test / unit / geom / shape / schema-spec.js View on Github external
const expect = require('chai').expect;
const { Canvas } = require('../../../../src/renderer');
const Schema = require('../../../../src/geom/shape/schema');
const Coord = require('@antv/coord/lib/');

const div = document.createElement('div');
div.id = 'csschema';
document.body.appendChild(div);

const canvas = new Canvas({
  containerId: 'csschema',
  width: 500,
  height: 500
});

const coord = new Coord.Rect({
  start: {
    x: 0,
    y: 500
  },
  end: {
    x: 500,
    y: 0
  }
});


describe('schema shapes', function() {
  Schema._coord = coord;
  describe('default', function() {
    it('default shape type', function() {
      expect(Schema.defaultShapeType).equal('');
github antvis / G2 / test / unit / geom / shape / edge-spec.js View on Github external
describe('edge shape test', function() {

  const coord = new Coord.Rect({
    start: {
      x: 0,
      y: 500
    },
    end: {
      x: 500,
      y: 0
    }
  });
  const shapeObj = Shape.getShapeFactory('edge');
  shapeObj._coord = coord;

  it('get default shape', function() {
    expect(shapeObj).not.equal(undefined);
    const shape = shapeObj.getShape();
    expect(shape).not.equal(undefined);
github antvis / G2 / test / unit / geom / util / path-spec.js View on Github external
it('convertNormalPath', function() {
    const coord = new Coord.Rect({
      start: {
        x: 0,
        y: 0
      },
      end: {
        x: 200,
        y: 200
      }
    });

    const path = [[ 'M', 0, 0 ], [ 'L', 1, 1 ]];
    expect(PathUtil.convertNormalPath(coord, path)).eqls([[ 'M', 0, 0 ], [ 'L', 200, 200 ]]);
  });
github antvis / G2 / test / unit / geom / shape / violin-spec.js View on Github external
const expect = require('chai').expect;
const { Canvas } = require('../../../../src/renderer');
const Violin = require('../../../../src/geom/shape/violin');
const Coord = require('@antv/coord/lib/');

const div = document.createElement('div');
div.id = 'csviolin';
document.body.appendChild(div);

const canvas = new Canvas({
  containerId: 'csviolin',
  width: 500,
  height: 500
});

const coord = new Coord.Rect({
  start: {
    x: 0,
    y: 500
  },
  end: {
    x: 500,
    y: 0
  }
});

describe('violin shapes', () => {
  const cfg = {
    x: 0.125,
    y: [ 0.0125, 0.044375, 0.07625, 0.108125, 0.14, 0.171875, 0.20375, 0.23562499999999997, 0.26749999999999996, 0.29937499999999995, 0.33124999999999993, 0.3631249999999999, 0.3949999999999999 ],
    y0: 0,
    size: 0.225,
github antvis / G2 / test / unit / geom / shape / interval-spec.js View on Github external
width: 500,
  height: 500
});

const coord = new Coord.Polar({
  start: {
    x: 0,
    y: 500
  },
  end: {
    x: 500,
    y: 0
  }
});

const coord1 = new Coord.Rect({
  start: {
    x: 0,
    y: 500
  },
  end: {
    x: 500,
    y: 0
  }
});

describe('interval shapes', function() {
  const cfg = {
    x: 1,
    y: 2,
    y0: 0,
    size: 1