1 | import { BandOptions, Domain } from '../types';
|
2 | import { Ordinal } from './ordinal';
|
3 | /**
|
4 | * Band 比例尺
|
5 | *
|
6 | * 一种特殊的 ordinal scale,区别在于值域的范围是连续的。
|
7 | * 使用的场景例如柱状图,可以用来定位各个柱子水平方向距离原点开始绘制的距离、各柱子之间的间距
|
8 | *
|
9 | * 由于部分选项较为抽象,见下图描述:
|
10 | *
|
11 | * BN = bandWidthN
|
12 | * SN = stepN
|
13 | * domain = [A, B]
|
14 | *
|
15 | * 约束关系如下
|
16 | * width = PO + B1 + PI + B2 + PI ... + BN + PO;
|
17 | * PO = (S1 + S2 + ... SN) / N * paddingOuter
|
18 | * PI = (S1 + S2 + ... SN) / N * paddingInner
|
19 | * BN / BN-1 = flex[n] / flex[n-1]
|
20 | *
|
21 | * |<------------------------------------------- range ------------------------------------------->|
|
22 | * | | | | | | |
|
23 | * |<-----PO---->|<------B1--------->|<-----PI---->|<-------B2-------->|<----PI----->|<-----PO---->|
|
24 | * | | ***************** | | ***************** | | |
|
25 | * | | ******* A ******* | | ******* B ******* | | |
|
26 | * | | ***************** | | ***************** | | |
|
27 | * | |<--------------S1--------------->| <--------------S2-------------->| |
|
28 | * |-----------------------------------------------------------------------------------------------|
|
29 | *
|
30 | */
|
31 | export declare class Band<O extends BandOptions = BandOptions> extends Ordinal<O> {
|
32 | private adjustedRange;
|
33 | private valueBandWidth;
|
34 | private valueStep;
|
35 | protected getDefaultOptions(): O;
|
36 | constructor(options?: BandOptions);
|
37 | clone(): Band<O>;
|
38 | getStep(x?: Domain<BandOptions>): any;
|
39 | getBandWidth(x?: Domain<BandOptions>): any;
|
40 | getRange(): O["range"];
|
41 | protected getPaddingInner(): number;
|
42 | protected getPaddingOuter(): number;
|
43 | protected rescale(): void;
|
44 | }
|