How to use the @antv/coord.getCoordinate 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 / packages / g2 / __tests__ / unit / element / shape / area-spec.js View on Github external
describe('area shapes Polar', () => {
    const Polar = getCoordinate('polar');
    const polarCoord = new Polar({
      start: {
        x: 0,
        y: 500,
      },
      end: {
        x: 500,
        y: 0,
      },
    });
    it('getShapePoints && drawShape', () => {
      AreaShapeFactory.setCoord(polarCoord);
      const type = 'area';
      const points1 = AreaShapeFactory.getShapePoints(type, {
        x: 0.1,
        y: 0.2,
github antvis / G2 / tests / unit / geometry / schema-spec.ts View on Github external
import { getCoordinate } from '@antv/coord';
import { getScale } from '@antv/scale';
import Schema from '../../../src/geometry/schema';
import Theme from '../../../src/theme/antv';
import { createCanvas, createDiv, removeDom } from '../../util/dom';

import 'jest-extended';
import { createScale } from '../../util/scale';

const CartesianCoordinate = getCoordinate('rect');
const LinearScale = getScale('linear');

describe('Schema', () => {
  const div = createDiv();
  const canvas = createCanvas({
    container: div,
    width: 300,
    height: 300,
  });
  const rectCoord = new CartesianCoordinate({
    start: { x: 0, y: 300 },
    end: { x: 300, y: 0 },
  });

  it('draw box', () => {
    const data = [
github antvis / G2 / tests / unit / geometry / util / shape-size-spec.ts View on Github external
import { getCoordinate } from '@antv/coord';
import { getScale } from '@antv/scale';
import Interval from '../../../../src/geometry/interval';
import { getDefaultSize } from '../../../../src/geometry/util/shape-size';
import Theme from '../../../../src/theme/antv';
import { createCanvas, createDiv, removeDom } from '../../../util/dom';

import 'jest-extended';
import { createScale } from '../../../util/scale';

const CartesianCoordinate = getCoordinate('rect');
const PolarCoordinate = getCoordinate('polar');

const CatScale = getScale('cat');
const IdentityScale = getScale('identity');

describe('Calculate shape size', () => {
  const div = createDiv();
  const canvas = createCanvas({
    container: div,
  });
  const rectCoord = new CartesianCoordinate({
    start: { x: 0, y: 180 },
    end: { x: 180, y: 0 },
  });
  const polarCoord = new PolarCoordinate({
    start: { x: 0, y: 180 },
    end: { x: 180, y: 0 },
github antvis / G2 / tests / unit / geometry / polygon-spec.ts View on Github external
import { getCoordinate } from '@antv/coord';
import Polygon from '../../../src/geometry/polygon';
import Theme from '../../../src/theme/antv';
import { createCanvas, createDiv, removeDom } from '../../util/dom';

import 'jest-extended';
import { createScale } from '../../util/scale';

const CartesianCoordinate = getCoordinate('rect');

describe('Polygon', () => {
  const div = createDiv();
  const canvas = createCanvas({
    container: div,
    width: 300,
    height: 300,
  });
  const rectCoord = new CartesianCoordinate({
    start: { x: 0, y: 300 },
    end: { x: 300, y: 0 },
  });
  const data = [
    { city: '杭州', sale: 100, category: '电脑' },
    { city: '广州', sale: 30, category: '电脑' },
    { city: '上海', sale: 200, category: '鼠标' },
github antvis / G2 / packages / g2 / __tests__ / unit / element / point-spec.js View on Github external
import { expect } from 'chai';
import { getCoordinate } from '@antv/coord';
import { Canvas } from '@antv/g';
import { getScale } from '@antv/scale';
import Point from '../../../src/element/point';

import ScatterData from '../../data/bubble';
import View from '../../utils/view';

const Rect = getCoordinate('rect');

const LinearScale = getScale('linear');
const IdentityScale = getScale('identity');

describe('Point Element', () => {
  const div = document.createElement('div');
  document.body.appendChild(div);

  let pointElement;

  const coord = new Rect({
    start: {
      x: 0,
      y: 200,
    },
    end: {
github antvis / G2 / packages / g2 / __tests__ / unit / element / shape / edge-spec.js View on Github external
import { expect } from 'chai';
import { Canvas } from '@antv/g';
import EdgeShapeFactory from '../../../../src/element/shape/edge';
import * as Shape from '../../../../src/element/shape/base';
import { getCoordinate } from '@antv/coord';
import Global from '../../../../src/global';

const Rect = getCoordinate('rect');

describe('Edge shape factory', () => {
  let div;
  let canvas;

  before(() => {
    div = document.createElement('div');
    div.id = 'edge-shape';
    document.body.appendChild(div);

    const coord = new Rect({
      start: {
        x: 0,
        y: 500,
      },
      end: {
github antvis / G2 / packages / component / __tests__ / unit / axis / helix-spec.js View on Github external
import { expect } from 'chai';
import { Canvas } from '@antv/g';
import { getCoordinate } from '@antv/coord';
import HelixAxis from '../../../src/axis/helix';

const Helix = getCoordinate('helix');

describe('Helix Axis for Helix Coord', function() {
  const div = document.createElement('div');
  document.body.appendChild(div);
  const coord = new Helix({
    start: {
      x: 60,
      y: 460,
    },
    end: {
      x: 460,
      y: 60,
    },
  });
  const canvas = new Canvas({
    containerDOM: div,
github antvis / G2 / packages / component / __tests__ / unit / annotation / text-spec.js View on Github external
const expect = require('chai').expect;
const { Canvas } = require('@antv/g');
const { getCoordinate } = require('@antv/coord');
const { getScale } = require('@antv/scale');
const { Text } = require('../../../src/annotation');

const Rect = getCoordinate('rect');
const Cat = getScale('cat');
const Linear = getScale('linear');

describe('Annotation Text', () => {
  const xScale = new Cat({
    values: ['一月', '二月', '三月', '四月', '五月'],
  });
  const yScale = new Linear({
    min: 0,
    max: 1200,
  });
  const coord = new Rect({
    start: { x: 60, y: 460 },
    end: { x: 460, y: 60 },
  });
  let canvas, group, div;
github antvis / G2 / tests / unit / animate / index-spec.ts View on Github external
import { getCoordinate } from '@antv/coord';
import { isNumberEqual } from '@antv/util';
import { doAnimate, doGroupAppearAnimate, getDefaultAnimateCfg } from '../../../src/animate/index';
import { createCanvas, createDiv, removeDom } from '../../util/dom';

const CartesianCoordinate = getCoordinate('rect');
const PolarCoordinate = getCoordinate('polar');
const HelixCoordinate = getCoordinate('helix');

describe('Animate', () => {
  const rectCoord = new CartesianCoordinate({
    start: { x: 0, y: 300 },
    end: { x: 300, y: 0 },
  });
  const polarCoord = new PolarCoordinate({
    start: { x: 0, y: 300 },
    end: { x: 300, y: 0 },
  });
  const helixCoord = new HelixCoordinate({
    start: { x: 0, y: 180 },
    end: { x: 180, y: 0 },
  });

  const thetaCoord = new PolarCoordinate({
github antvis / G2 / packages / g2 / __tests__ / unit / element / area-spec.js View on Github external
import { expect } from 'chai';
import Area from '../../../src/element/area';
import { Canvas } from '@antv/g';
import { getScale } from '@antv/scale';
import { getCoordinate } from '@antv/coord';
import View from '../../utils/view';

const Rect = getCoordinate('rect');
const LinearScale = getScale('linear');
const CatScale = getScale('cat');

describe('Area', () => {
  describe('Default', () => {
    const areaDiv = document.createElement('div');
    areaDiv.id = 'area1';
    document.body.appendChild(areaDiv);

    let areaElement;

    const yearScale = new CatScale({
      field: 'year',
      values: ['1994', '1995', '1996'],
      range: [0, 1],
    });