Skip to content

Commit 9de618a

Browse files
refactor: add JSDocs to domain properties & refactor
1 parent f31e9b6 commit 9de618a

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

src/lib/series/specs.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,32 @@ export type Datum = any;
1717
export type Rotation = 0 | 90 | -90 | 180;
1818
export type Rendering = 'canvas' | 'svg';
1919

20-
export interface LowerBoundedDomain {
21-
min: number;
20+
interface DomainMinInterval {
21+
/** Custom minInterval for the domain which will affect data bucket size.
22+
* The minInterval cannot be greater than the computed minimum interval between any two adjacent data points.
23+
* Further, if you specify a custom numeric minInterval for a timeseries, please note that due to the restriction
24+
* above, the specified numeric minInterval will be interpreted as a fixed interval.
25+
* This means that, for example, if you have yearly timeseries data that ranges from 2016 to 2019 and you manually
26+
* compute the interval between 2016 and 2017, you'll have 366 days due to 2016 being a leap year. This will not
27+
* be a valid interval because it is greater than the computed minInterval of 365 days betwen the other years.
28+
*/
2229
minInterval?: number;
2330
}
2431

25-
export interface UpperBoundedDomain {
26-
max: number;
27-
minInterval?: number;
32+
interface LowerBound {
33+
/** Lower bound of domain range */
34+
min: number;
2835
}
2936

30-
export interface CompleteBoundedDomain {
31-
min: number;
37+
interface UpperBound {
38+
/** Upper bound of domain range */
3239
max: number;
33-
minInterval?: number;
3440
}
3541

36-
export interface UnboundedDomainWithInterval {
37-
minInterval: number;
38-
}
42+
export type LowerBoundedDomain = DomainMinInterval & LowerBound;
43+
export type UpperBoundedDomain = DomainMinInterval & UpperBound;
44+
export type CompleteBoundedDomain = DomainMinInterval & LowerBound & UpperBound;
45+
export type UnboundedDomainWithInterval = DomainMinInterval;
3946

4047
export type DomainRange = LowerBoundedDomain | UpperBoundedDomain | CompleteBoundedDomain | UnboundedDomainWithInterval;
4148

0 commit comments

Comments
 (0)