1 |
|
2 | export type TickMethod<T = number> = (min: T, max: T, n?: number, ...rest: any[]) => T[];
|
3 |
|
4 | export type NiceMethod<T = number> = TickMethod<T>;
|
5 |
|
6 | export type Interpolate<T = number> = (a: T, b: T) => (t: number) => T;
|
7 |
|
8 | export type Interpolator = (t: number) => any;
|
9 |
|
10 | export type Interpolates = Interpolate<number> | Interpolate<string> | Interpolate<number | string>;
|
11 |
|
12 | export type Comparator = (a: any, b: any) => number;
|
13 |
|
14 | export type TickMethodOptions<T = number | Date> = [T, T, number, number?, boolean?];
|
15 |
|
16 | export type Transform = (x: any) => any;
|
17 |
|
18 | export type CreateTransform = (...args: any[]) => Transform;
|
19 |
|
20 | export type BaseOptions = {
|
21 |
|
22 | unknown?: any;
|
23 |
|
24 | range?: any[];
|
25 |
|
26 | domain?: any[];
|
27 | };
|
28 |
|
29 | export type Domain<O extends BaseOptions> = O['domain'][number];
|
30 |
|
31 | export type Range<O extends BaseOptions> = O['range'][number];
|
32 |
|
33 | export type Unknown<O extends BaseOptions> = O['unknown'];
|
34 |
|
35 |
|
36 | export type IdentityOptions = {
|
37 |
|
38 | unknown?: any;
|
39 |
|
40 | range?: any[];
|
41 |
|
42 | domain?: any[];
|
43 |
|
44 | tickCount?: number;
|
45 |
|
46 | tickMethod?: TickMethod<number>;
|
47 | };
|
48 |
|
49 | export type ConstantOptions = {
|
50 |
|
51 | unknown?: any;
|
52 |
|
53 | range?: any[];
|
54 |
|
55 | domain?: any[];
|
56 |
|
57 | tickCount?: number;
|
58 |
|
59 | tickMethod?: TickMethod<number>;
|
60 | };
|
61 |
|
62 | export type ContinuousOptions = {
|
63 |
|
64 | unknown?: any;
|
65 |
|
66 | range?: (number | string)[];
|
67 |
|
68 | domain?: (number | Date)[];
|
69 |
|
70 | tickCount?: number;
|
71 |
|
72 | tickMethod?: TickMethod<number | Date>;
|
73 |
|
74 | nice?: boolean;
|
75 |
|
76 | clamp?: boolean;
|
77 |
|
78 | round?: boolean;
|
79 |
|
80 | interpolate?: Interpolates;
|
81 | };
|
82 |
|
83 | export type LinearOptions = {
|
84 |
|
85 | unknown?: any;
|
86 |
|
87 | range?: (number | string)[];
|
88 |
|
89 | domain?: number[];
|
90 |
|
91 | tickCount?: number;
|
92 |
|
93 | tickMethod?: TickMethod<number>;
|
94 |
|
95 | nice?: boolean;
|
96 |
|
97 | clamp?: boolean;
|
98 |
|
99 | round?: boolean;
|
100 |
|
101 | interpolate?: Interpolates;
|
102 | };
|
103 |
|
104 | export type PowOptions = LinearOptions & {
|
105 |
|
106 | exponent?: number;
|
107 | };
|
108 |
|
109 | export type SqrtOptions = LinearOptions;
|
110 |
|
111 | export type LogOptions = LinearOptions & {
|
112 |
|
113 | base?: number;
|
114 | };
|
115 |
|
116 | export type TimeOptions = {
|
117 |
|
118 | unknown?: any;
|
119 |
|
120 | range?: (number | string)[];
|
121 |
|
122 | domain?: Date[];
|
123 |
|
124 | tickCount?: number;
|
125 |
|
126 | tickMethod?: TickMethod<Date>;
|
127 |
|
128 | nice?: boolean;
|
129 |
|
130 | clamp?: boolean;
|
131 |
|
132 | round?: boolean;
|
133 |
|
134 | interpolate?: Interpolates;
|
135 |
|
136 | tickInterval?: number;
|
137 |
|
138 | mask?: string;
|
139 |
|
140 | utc?: boolean;
|
141 | };
|
142 |
|
143 | export type OrdinalOptions = {
|
144 |
|
145 | unknown?: any;
|
146 |
|
147 | range?: any[];
|
148 |
|
149 | domain?: any[];
|
150 |
|
151 | compare?: Comparator;
|
152 | };
|
153 |
|
154 | export type BandOptions = {
|
155 |
|
156 | unknown?: any;
|
157 |
|
158 | range?: number[];
|
159 |
|
160 | domain?: any[];
|
161 |
|
162 | round?: boolean;
|
163 |
|
164 | paddingInner?: number;
|
165 |
|
166 | paddingOuter?: number;
|
167 |
|
168 | padding?: number;
|
169 |
|
170 | align?: number;
|
171 |
|
172 | compare?: Comparator;
|
173 |
|
174 | flex?: number[];
|
175 | };
|
176 |
|
177 | export type PointOptions = Omit<BandOptions, 'paddingInner' | 'paddingOuter'>;
|
178 |
|
179 | export type ThresholdOptions = {
|
180 |
|
181 | unknown?: any;
|
182 |
|
183 | range?: any[];
|
184 |
|
185 | domain?: number[];
|
186 | };
|
187 |
|
188 | export type QuantizeOptions = {
|
189 |
|
190 | unknown?: any;
|
191 |
|
192 | range?: any[];
|
193 |
|
194 | domain?: number[];
|
195 |
|
196 | nice?: boolean;
|
197 |
|
198 | tickCount?: number;
|
199 |
|
200 | tickMethod?: TickMethod<number>;
|
201 | };
|
202 |
|
203 | export type QuantileOptions = {
|
204 |
|
205 | unknown?: any;
|
206 |
|
207 | range?: any[];
|
208 |
|
209 | domain?: number[];
|
210 |
|
211 | tickCount?: number;
|
212 |
|
213 | tickMethod?: TickMethod<number>;
|
214 | };
|
215 |
|
216 | export type SequentialOptions = Omit<LinearOptions, 'Interpolates'> & {
|
217 | interpolator?: Interpolator;
|
218 | };
|
219 |
|
220 | export type DivergingOptions = Omit<LinearOptions, 'Interpolates'> & {
|
221 | interpolator?: Interpolator;
|
222 | };
|