Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 3.3 KB

README.md

File metadata and controls

55 lines (40 loc) · 3.3 KB

API Reference

There are two parts of API Reference for @antv/coord. Follow the links below to learn more.

Coordinate

The object to specify and apply transformations.

  • Coordinate - Returns a new coordinate object with specified options.
  • coord.update - Updates the options of the coordinate object.
  • coord.transform - Specifies transformation to be applied to the input vector.
  • coord.clear - Clears current transformations.
  • coord.map - Applies specified transformations to input vector and returns the transformed vector.
  • coord.invert - Invert the specified transformations to transformed vector and returns the original vector.
  • coord.getSize - Returns the size of the bounding box of the coordinate object.
  • coord.getCenter - Returns the center of the bounding box of the coordinate object.
  • coord.clone - Returns a new coordinate object with the same but independent options.

Transformations

Built-in transformations can applied to the input vector.

Affine

  • translate - Sends (x, y) to (x + b, y + b).
  • scale - Sends (x, y) to (a * x, b * y).
  • rotate - Sends (x, y) to (cos(theta)) * x - sin(theta) * y, sin(theta) * x - cos(theta) * y).
  • reflect - Sends (x, y) to (-x, -y).
  • reflect.x - Sends (x, y) to (-x, y).
  • reflect.y - Sends (x, y) to (x, -y).
  • shear.x - Sends (x, y) to (cot(theta) * y + x, y).
  • shear.y - Sends (x, y) to (x, cot(theta) * x + y).
  • transpose - Sends (x, y) to (y, x).

Coordinate System

  • cartesian - Transforms points in normalized cartesian system to the bounding box of the coordinate.
  • polar - Transforms points in normalized polar system to normalized cartesian system.
  • helix - Transforms points in normalized helix system to normalized cartesian system.
  • parallel - Transforms points in normalized parallel system to normalized cartesian system.

Fisheye Lens

  • fisheye - Applies cartesian fisheye effects for both dimensions of input vector.
  • fisheye.x - Applies cartesian fisheye effects for the x dimensions of input vector.
  • fisheye.y - Applies cartesian fisheye effects for the y dimensions of input vector.
  • fisheye.circular - Applies circular fisheye effects for input vector.

User Defined

  • custom - Customizes transform and untransform functions.
  • matrix - Customizes transform matrix.