Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T10:16:43.000Z (6 months ago)
- Last Synced: 2024-05-21T16:35:05.077Z (6 months ago)
- Topics: mapping, scale, ticks, visualization
- Language: TypeScript
- Homepage: https://observablehq.com/@antv/aloha-antv-scale
- Size: 642 KB
- Stars: 56
- Watchers: 44
- 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)
![scale mapping](https://user-images.githubusercontent.com/7856674/116353528-85644a80-a829-11eb-85e4-3463a29000a9.png)
[![Build Status](https://github.com/antvis/scale/workflows/build/badge.svg?branch=master)](https://github.com/antvis/scale/actions)
[![Coverage Status](https://img.shields.io/coveralls/github/antvis/scale/master.svg)](https://coveralls.io/github/antvis/scale?branch=master)
[![npm Version](https://img.shields.io/npm/v/@antv/scale.svg)](https://www.npmjs.com/package/@antv/scale)
[![npm Download](https://img.shields.io/npm/dm/@antv/scale.svg)](https://www.npmjs.com/package/@antv/scale)
[![npm License](https://img.shields.io/npm/l/@antv/scale.svg)](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.![scale examples](https://gw.alipayobjects.com/mdn/rms_40052e/afts/img/A*Usg2S685JQkAAAAAAAAAAAAAARQnAQ)
## ๐ฆ 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).