@antv/scale
TypeScript icon, indicating that this package has built-in type declarations

0.4.15 • Public • Published

@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.

/@antv/scale/

    Package Sidebar

    Install

    npm i @antv/scale

    Weekly Downloads

    120,741

    Version

    0.4.15

    License

    MIT

    Unpacked Size

    508 kB

    Total Files

    320

    Last publish

    Collaborators

    • xuying1027
    • lvisei
    • yisi.wang
    • basketduck
    • biupiubiupiu
    • flash1
    • dreammy23
    • laixingui.lxg
    • zhangjunjie-loki
    • rainy25ghz
    • zeyuwang
    • yanxiong
    • susiwen8
    • freestyle21
    • soundquiet
    • elaine.q.10
    • sturuby
    • sakuya223
    • serializedowen
    • xdzhao
    • yangzhanmei
    • wjgogogo
    • leungwensen
    • dori
    • iaaron
    • yard
    • simaq
    • dxq613
    • intchous
    • susan_ann
    • jinke.li
    • lzxue
    • army8735
    • atool
    • baizn
    • dengfuping
    • neoddish
    • jeffy2012
    • zqlu
    • afc163
    • pomelo-nwu
    • kopiluwaky
    • ccnuzindex
    • panyuqi
    • bubkoo
    • zengyue
    • kasmine
    • boyu.zlj
    • l1ud0ngq1
    • newbyvector
    • winniexing
    • chenluli
    • kn9117
    • xdddst
    • semious2020
    • esora
    • nadia_liu
    • bbsqq
    • mxz96102
    • openwayne
    • pearmini
    • pddpd
    • yiqianyao
    • zhanba
    • cxxxxxn
    • xcf(-_-)
    • siqishen
    • boyyangzai