@antv/scale
Toolkit for mapping abstract data into visual representation.
Last updated 3 years ago by pearmini .
MIT · Repository · Bugs · Original npm
$ cnpm install @antv/scale 
SYNC missed versions from official npm registry.

@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 git@github.com:antvis/scale.git

$ cd scale

$ npm i

$ npm t

Then send a pull request after coding.

📄 License

MIT@AntV.

Current Tags

  • 0.4.11                                ...           latest (3 years ago)
  • 0.1.5                                ...           v1.0-latest (5 years ago)

10 Versions

  • 0.4.11                                ...           3 years ago
  • 0.3.18                                ...           3 years ago
  • 0.4.6                                ...           4 years ago
  • 0.4.0-beta.1                                ...           4 years ago
  • 0.3.14                                ...           4 years ago
  • 0.3.7-beta.1                                ...           5 years ago
  • 0.3.9                                ...           5 years ago
  • 0.2.3                                ...           6 years ago
  • 0.3.3                                ...           5 years ago
  • 0.1.5                                ...           5 years ago

Copyright 2013 - present © cnpmjs.org