$ npm install @antv/scale
$ npm install @antv/scale
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]
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]
$ git clone git@github.com:antvis/scale.git
$ cd scale
$ npm i
$ npm t
写完代码之后,提交 PR 即可。
MIT@AntV.
© 2010 - cnpmjs.org x YWFE | Home | YWFE