Skip to content
/ scale Public

๐Ÿ“ฆ Toolkit for mapping abstract data into visual representation.

License

Notifications You must be signed in to change notification settings

antvis/scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3950702 ยท Feb 21, 2025

History

88 Commits
May 13, 2021
Mar 30, 2021
Dec 18, 2023
Sep 5, 2022
Dec 20, 2023
Mar 25, 2021
Sep 6, 2022
Apr 6, 2021
Mar 25, 2021
Mar 25, 2021
Nov 23, 2023
Nov 23, 2023
Apr 12, 2021
Jan 23, 2025
Apr 21, 2023
Feb 21, 2025

Repository files navigation

@antv/scale

Toolkit for mapping abstract data into visual representation. Living Demo ยท ไธญๆ–‡ๆ–‡ๆกฃ

scale mapping

Build Status Coverage Status npm Version npm Download npm License

โœจ 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

๐Ÿ“ฆ Installation

$ npm install @antv/scale

๐Ÿ”จ Getting Started

  • Basic usage
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
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

๐Ÿ“ฎ Contribution

$ git clone [email protected]:antvis/scale.git

$ cd scale

$ npm i

$ npm t

Then send a pull request after coding.

๐Ÿ“„ License

MIT@AntV.