1 | <h1 align="center">
|
2 | <b>@antv/coord</b>
|
3 | </h1>
|
4 | <div align="center">
|
5 |
|
6 | Toolkit for mapping elements of sets into geometric objects. ([demo](https://observablehq.com/@pearmini/antv-coord))
|
7 |
|
8 | 
|
9 |
|
10 | [](https://github.com/antvis/coord/actions)
|
11 | [](https://coveralls.io/github/antvis/coord?branch=master)
|
12 | [](https://www.npmjs.com/package/@antv/coord)
|
13 | [](https://www.npmjs.com/package/@antv/coord)
|
14 | [](https://www.npmjs.com/package/@antv/coord)
|
15 |
|
16 | </div>
|
17 |
|
18 | ## ✨ Features
|
19 |
|
20 | - **Powerful**: Not only does @antv/coord provide some basic affine transformations(translate, rotate, scale, etc.), it also provide some advanced coordinate system transformations(polar, helix, parallel) and cool fisheye transformations.
|
21 | - **Fixable**: It is a independent lib which means you can use it with other libs besides [G2](https://github.com/antvis/g2/), such as [D3](https://github.com/d3/d3) to create some awesome charts and animations.
|
22 | - **Fully embrace TypeScript**: All code are written in TypeScript and complete type definition files are provided.
|
23 |
|
24 | 
|
25 |
|
26 | ## 📦 Installation
|
27 |
|
28 | ```bash
|
29 | $ npm install @antv/coord
|
30 | ```
|
31 |
|
32 | ## 🔨 Getting Started
|
33 |
|
34 | ```ts
|
35 | import { Coordinate, Options } from '@antv/coord';
|
36 |
|
37 | const optons: Options = {
|
38 | x: 0,
|
39 | y: 0,
|
40 | width: 500,
|
41 | height: 500,
|
42 | transformations: [['cartesian']]
|
43 | };
|
44 |
|
45 | const coord = new Coordinate(options);
|
46 | coord.transform('translate', 10, 10);
|
47 | coord.map([0.5, 0.5]); // [260, 260]
|
48 | coord.getSize(); // [500, 500]
|
49 | coord.getCenter(); // [250, 250]
|
50 | ```
|
51 |
|
52 | ## 📎 Links
|
53 |
|
54 | - [Online Demo](https://observablehq.com/@pearmini/antv-coord)
|
55 | - [API Reference](./docs/api/README.md)
|
56 |
|
57 | ## 📮 Contribution
|
58 |
|
59 | ```bash
|
60 | $ git clone git@github.com:antvis/coord.git
|
61 |
|
62 | $ cd coord
|
63 |
|
64 | $ npm i
|
65 |
|
66 | $ npm t
|
67 | ```
|
68 |
|
69 | Then send a pull request after coding.
|
70 |
|
71 | ## 📄 License
|
72 |
|
73 | MIT@[AntV](https://github.com/antvis).
|