scale icon indicating copy to clipboard operation
scale copied to clipboard

feat: add diverging scale (close: #190)

Open pepper-nice opened this issue 3 years ago • 2 comments
trafficstars

Usage

  • [x] source
  • [x] test: coverage 100%
  • [x] docs

API

import { Diverging, DivergingOptions } from '@antv/scale';

const scale = new Diverging({
  domain: [-10, 0, 10],
  interpolator: (t) => 1 - t,
});

scale.map(5); // 0.25
scale.map(2); // 0.4
scale.map(-5); // 0.75
scale.getOptions().range; // [1, 0.5, 0]

pepper-nice avatar Aug 30 '22 13:08 pepper-nice

类型 TransformCreateTransform 之前在 ./scales/Continuous.ts 文件中导出。由于 ./utils/intepolatize.ts 需要使用到,把这两个移入到了 types.ts 文件。所以其他文件有一些 import 的变动。

pepper-nice avatar Sep 01 '22 07:09 pepper-nice

close: #190 写在 pr 描述中,方便其他看的人快速跳转过去

visiky avatar Sep 02 '22 01:09 visiky