How to use the @antv/coord/lib/index.Cartesian 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 / animate / animate-spec.js View on Github external
it('Animate.getAnimation', () => {
    const coord = new Coord.Cartesian({
      start: {
        x: 0,
        y: 300
      },
      end: {
        x: 200,
        y: 0
      }
    });
    let geomType = 'heatmap';
    let animationType = 'appear';
    let result = Animate.getAnimation(geomType, coord, animationType);
    expect(result).to.equal(false);

    geomType = 'axis-ticks';
    animationType = 'update';
github antvis / G2 / test / unit / animate / index-spec.js View on Github external
const expect = require('chai').expect;
const Animate = require('../../../src/animate/index');
const Coord = require('@antv/coord/lib/index');
const View = require('../../../src/chart/view');
const { Canvas } = require('../../../src/renderer');

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

const coord = new Coord.Cartesian({
  start: {
    x: 0,
    y: 300
  },
  end: {
    x: 600,
    y: 0
  }
});

function addElements(count, container, backContainer) {
  for (let i = 0; i < count; i++) {
    const shape = container.addShape('circle', {
      attrs: {
        x: 300 * Math.random(),
        y: 300 * Math.random(),
github antvis / G2 / test / unit / geom / label / interval-labels-spec.js View on Github external
describe('interval labels', () => {
  const div = document.createElement('div');
  div.id = 'gl1';
  document.body.appendChild(div);

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

  const coord = new Coord.Cartesian({
    start: {
      x: 80, y: 168
    },
    end: {
      x: 970, y: 20
    }
  });

  const labelScale = Scale.linear({
    field: 'percent',
    formatter: val => { return val.toFixed(4) * 100 + '%'; },
    values: [ 0.5169927909371782, 0.5545851528384279 ]
  });
  const points = [
    { _origin: { country: 'Asia', year: '1750', value: 502, percent: 0.5169927909371782 }, points: [{ x: 0.03571428571428571, y: 0.48300720906282185 }, { x: 0.03571428571428571, y: 1 }, { x: 0.10714285714285714, y: 1 }, { x: 0.10714285714285714, y: 0.48300720906282185 }], nextPoints: [{ x: 0.03571428571428571, y: 0.3738414006179197 }, { x: 0.03571428571428571, y: 0.48300720906282185 }, { x: 0.10714285714285714, y: 0.48300720906282185 }, { x: 0.10714285714285714, y: 0.3738414006179197 }], x: 143.57142857142856, y: [ 219.04222451081358, 20 ], color: '#FF6A84', shape: 'top-line' },
    { _origin: { country: 'Asia', year: '1800', value: 635, percent: 0.5545851528384279 }, points: [{ x: 0.17857142857142855, y: 0.4454148471615721 }, { x: 0.17857142857142855, y: 1 }, { x: 0.25, y: 1 }, { x: 0.25, y: 0.4454148471615721 }], x: 270.71428571428567, y: [ 233.51528384279476, 20 ], color: '#FF6A84', shape: 'top-line' }