https://github.com/antvis/scale
๐ฆ Toolkit for mapping abstract data into visual representation.
https://github.com/antvis/scale
mapping scale ticks visualization
Last synced: 3 months ago
JSON representation
๐ฆ Toolkit for mapping abstract data into visual representation.
- Host: GitHub
- URL: https://github.com/antvis/scale
- Owner: antvis
- License: mit
- Created: 2018-06-22T15:37:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T10:16:43.000Z (about 1 year ago)
- Last Synced: 2024-10-29T21:05:31.341Z (9 months ago)
- Topics: mapping, scale, ticks, visualization
- Language: TypeScript
- Homepage: https://observablehq.com/@antv/aloha-antv-scale
- Size: 642 KB
- Stars: 57
- Watchers: 43
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - scale
README
@antv/scale> Toolkit for mapping abstract data into visual representation. [Living Demo](https://observablehq.com/@pearmini/antv-scale) ยท [ไธญๆๆๆกฃ](./README.md)

[](https://github.com/antvis/scale/actions)
[](https://coveralls.io/github/antvis/scale?branch=master)
[](https://www.npmjs.com/package/@antv/scale)
[](https://www.npmjs.com/package/@antv/scale)
[](https://www.npmjs.com/package/@antv/scale)## โจ Features
- **Powerful**: Ability to customize tickMethod are offered with abundant kinds of scales.
- **High performance**: Use different methods to cache some state of scales to improve performance.
- **Fully embrace TypeScript**: All code are written in TypeScript and complete type definition files are provided.
## ๐ฆ Installation
```bash
$ npm install @antv/scale
```## ๐จ Getting Started
- Basic usage
```ts
import { Linear, LinearOptions } from '@antv/scale';const options: LinearOptions = {
domain: [0, 10],
range: [0, 100],
};
const x = new Linear(options);x.map(2); // 20
x.invert(20); // 2
x.getTicks(); // [0, 2.5, 5, 7.5, 10]
```- Customize tickMethod
```ts
import { Linear } from '@antv/scale';const x = new Linear({
domain: [0, 10],
range: [0, 100],
tickCount: 3,
tickMethod: () => [0, 5, 10],
});x.getTicks(); // [0, 5, 10]
```## ๐ Links
- [Introduction](https://observablehq.com/@pearmini/antv-scale)
- [API Reference](./docs/api/readme.md)## ๐ฎ Contribution
```bash
$ git clone [email protected]:antvis/scale.git$ cd scale
$ npm i
$ npm t
```Then send a pull request after coding.
## ๐ License
MIT@[AntV](https://github.com/antvis).