How to use the @antv/coord/lib/index.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 / chart / controller / axis-spec.js View on Github external
it('_getLineCfg, X axis when coord is transposed.', function() {
      const coord = new Coord.Rect({
        start,
        end
      });
      coord.transpose();
      const lineCfg = as._getLineCfg(coord, scaleX, 'x');
      expect(lineCfg.isVertical).to.equal(true);
      expect(lineCfg.factor).to.equal(-1);
      expect(lineCfg.start).to.eql({ x: 0, y: 500 });
      expect(lineCfg.end).to.eql({ x: 0, y: 0 });
    });
  });
github antvis / G2 / test / unit / component / guide / html-spec.js View on Github external
describe('Guide: 辅助 html', function() {
  const coord = new Coord.Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 }
  });

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

  const group = canvas.addGroup();

  const xScale = Scale.cat({
    values: [ '一月', '二月', '三月', '四月', '五月' ]
  });
github antvis / G2 / test / unit / component / guide / line-spec.js View on Github external
describe('Guide: 辅助线', function() {
  const coord = new Coord.Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 }
  });

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

  const group = canvas.addGroup();

  const xScale = Scale.cat({
    values: [ '一月', '二月', '三月', '四月', '五月' ]
  });
github antvis / G2 / test / unit / component / guide / region-spec.js View on Github external
describe('Guide: 辅助背景框', function() {
  const coord = new Coord.Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 }
  });

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

  const group = canvas.addGroup();

  const xScale = Scale.cat({
    values: [ '一月', '二月', '三月', '四月', '五月' ]
  });
github antvis / G2 / test / unit / chart / controller / guide-spec.js View on Github external
max: 100,
    values: [ 0, 20, 40, 60, 80, 100 ],
    ticks: [ 0, 20, 40, 60, 80, 100 ],
    field: 'y2'
  });


  const xScales = {
    x: xScale
  };
  const yScales = {
    y1: yScale1,
    y2: yScale2
  };

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

  const data = [
    { x: 'a', y1: 250 },
    { x: 'b', y1: 350 },
    { x: 'c', y1: 150 },
    { x: 'd', y1: 450 },
    { x: 'e', y1: 550 }
github antvis / G2 / test / unit / geom / geom-spec.js View on Github external
const scaleC = Scale.cat({
  field: 'c',
  values: [ '1', '2' ]
});

const ScaleRed = Scale.identity({
  field: 'red',
  value: 'red'
});

const ScaleTen = Scale.identity({
  field: '10',
  value: 10
});
const coord = new Coord.Rect({
  start: {
    x: 0,
    y: 0
  },
  end: {
    x: 500,
    y: 500
  }
});

describe('test geoms', function() {
  const data = [{
    a: 1,
    b: 2,
    c: '1'
  }, {
github antvis / G2 / test / unit / component / guide / image-spec.js View on Github external
describe('Guide: 辅助图片', function() {
  const coord = new Coord.Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 }
  });

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

  const group = canvas.addGroup();

  const xScale = Scale.cat({
    values: [ '一月', '二月', '三月', '四月', '五月' ]
  });
github antvis / G2 / test / unit / chart / view-spec.js View on Github external
const View = require('../../../src/chart/view');
const Chart = require('../../../src/chart/chart');
const Coord = require('@antv/coord/lib/index');
const Theme = require('../../../src/theme/index');

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

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

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

describe('test view', function() {
  const backPlot = canvas.addGroup();
  const group = canvas.addGroup();
  const view = new View({
    middlePlot: group,
    canvas,
github antvis / G2 / test / unit / component / guide / text-spec.js View on Github external
describe('Guide: 辅助文本', function() {
  const coord = new Coord.Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 }
  });

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

  const group = canvas.addGroup();

  const xScale = Scale.cat({
    values: [ '一月', '二月', '三月', '四月', '五月' ]
  });
github antvis / G2 / test / unit / chart / controller / axis-spec.js View on Github external
describe('AxisController', function() {
  const start = {
    x: 0,
    y: 500
  };
  const end = {
    x: 500,
    y: 0
  };
  const coord = new Coord.Rect({
    start,
    end
  });
  const scaleX = {
    field: 'a',
    getTicks() {
      return [
        { value: 1 },
        { value: 2 },
        { value: 3 },
        { value: 4 },
        { value: 5 },
        { value: 6 },
        { value: 7 },
        { value: 8 },
        { value: 9 },