@windborne/grapher 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +149 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windborne/grapher",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Graphing library",
5
5
  "main": "src/index.js",
6
6
  "module": "dist/bundle.esm.js",
package/src/index.d.ts CHANGED
@@ -1,37 +1,160 @@
1
1
  import React from 'react';
2
2
 
3
+ export interface SeriesData {
4
+ data: any[] | { observe: (callback: Function) => void } | Function;
5
+ type?: 'values' | 'tuples' | 'objects' | 'tuple_observable' | 'object_observable' | 'infer';
6
+ xKey?: string;
7
+ yKey?: string;
8
+ xUnixDates?: boolean;
9
+ color?: string | number;
10
+ name?: string;
11
+ xLabel?: string;
12
+ yLabel?: string;
13
+ ignoreDiscontinuities?: boolean;
14
+ dashed?: boolean;
15
+ dashPattern?: number[];
16
+ width?: number;
17
+ rangeSelectorWidth?: number;
18
+ axis?: string | object;
19
+ expandYWith?: number[];
20
+ defaultAlwaysTooltipped?: boolean;
21
+ square?: boolean;
22
+ shiftXBy?: number;
23
+ graph?: number;
24
+ background?: object;
25
+ hideFromKey?: boolean;
26
+ showIndividualPoints?: boolean;
27
+ rendering?: 'line' | 'bar' | 'area';
28
+ negativeColor?: string;
29
+ gradient?: any[];
30
+ zeroLineWidth?: number;
31
+ zeroLineColor?: string;
32
+ zeroLineY?: number | string;
33
+ pointRadius?: number;
34
+ tooltipWidth?: number;
35
+ hasAreaBottom?: boolean;
36
+ shadowColor?: string;
37
+ rangeKey?: string;
38
+ }
39
+
40
+ export interface TooltipOptions {
41
+ includeSeriesLabel?: boolean;
42
+ includeXLabel?: boolean;
43
+ includeYLabel?: boolean;
44
+ includeXValue?: boolean;
45
+ includeYValue?: boolean;
46
+ floating?: boolean;
47
+ alwaysFixedPosition?: boolean;
48
+ floatPosition?: 'top' | 'bottom';
49
+ floatDelta?: number;
50
+ savingDisabled?: boolean;
51
+ customTooltip?: React.ComponentType<any>;
52
+ combineTooltips?: boolean | number;
53
+ }
54
+
55
+ export interface CustomBoundsSelector {
56
+ label: string;
57
+ calculator: (globalBounds?: any) => any;
58
+ datesOnly?: boolean;
59
+ }
60
+
61
+ export interface Annotation {
62
+ x?: string | number | Date;
63
+ startX?: string | number | Date;
64
+ endX?: string | number | Date;
65
+ series?: string[];
66
+ content?: string;
67
+ lineOnly?: boolean;
68
+ }
69
+
70
+ export interface DraggablePoint {
71
+ x: number;
72
+ y: number;
73
+ radius?: number;
74
+ fillColor?: string;
75
+ strokeColor?: string;
76
+ strokeWidth?: number;
77
+ onClick?: (point: DraggablePoint) => void;
78
+ onDoubleClick?: (point: DraggablePoint) => void;
79
+ }
80
+
81
+ export interface VerticalLine {
82
+ x: number;
83
+ color?: string;
84
+ lineTop?: number;
85
+ width?: number;
86
+ markTop?: boolean;
87
+ style?: object;
88
+ markerStyle?: object;
89
+ text?: string;
90
+ textTop?: number;
91
+ textStyle?: object;
92
+ minPixelX?: number;
93
+ maxPixelX?: number;
94
+ onRangeGraph?: boolean | object;
95
+ onRangeGraphOnly?: boolean;
96
+ }
97
+
3
98
  export interface GrapherProps {
4
- id: string;
5
- series: any[];
6
- theme?: string;
99
+ series: SeriesData[];
100
+
101
+ id?: string;
102
+ webgl?: boolean;
103
+ requireWASM?: boolean;
104
+ checkIntersection?: boolean;
105
+
106
+ onAxisChange?: (axes: any) => void;
107
+ onRenderTime?: (time: number) => void;
108
+ exportStateController?: (controller: any) => void;
109
+ onPointDrag?: (point: any) => void;
110
+ onDraggablePointsDoubleClick?: (point: any) => void;
111
+ onPointClick?: (point: any) => void;
112
+ timingFrameCount?: number;
113
+
114
+ stateControllerInitialization?: any;
115
+ syncPool?: any;
116
+ dragPositionYOffset?: number;
117
+
118
+ theme?: 'day' | 'night' | 'export';
119
+ title?: string;
120
+ fullscreen?: boolean;
121
+ bodyHeight?: number;
122
+ height?: number | string;
123
+ width?: number | string;
124
+
7
125
  showAxes?: boolean;
8
126
  showRangeGraph?: boolean;
9
127
  showRangeSelectors?: boolean;
10
128
  showSeriesKey?: boolean;
11
129
  showTooltips?: boolean;
130
+ showGrid?: boolean;
131
+ showAxisColors?: boolean;
132
+ bigLabels?: boolean;
133
+
134
+ xTickUnit?: 'year';
135
+ formatXAxisLabel?: (value: any) => string;
136
+ xAxisIntegersOnly?: boolean;
137
+ clockStyle?: '12h' | '24h';
138
+ timeZone?: string;
139
+ markRangeGraphDates?: boolean;
140
+
12
141
  boundsSelectionEnabled?: boolean;
13
- customBoundsSelectors?: any[];
142
+ customBoundsSelectors?: CustomBoundsSelector[];
143
+ customBoundsSelectorsOnly?: boolean;
14
144
  sidebarEnabled?: boolean;
145
+ defaultBoundsCalculator?: string;
146
+
147
+ percentile?: number;
15
148
  defaultShowAnnotations?: boolean;
16
149
  defaultShowOptions?: boolean;
17
- fullscreen?: boolean;
18
- height?: number | string;
19
- width?: number | string;
20
- title?: string;
21
- annotations?: any[];
22
- onAxisChange?: (axes: any) => void;
23
- onRenderTime?: (time: number) => void;
24
- exportStateController?: (controller: any) => void;
25
- stateControllerInitialization?: any;
26
- timingFrameCount?: number;
27
- percentile?: number;
28
- showAxisColors?: boolean;
29
- showGrid?: boolean;
30
- bigLabels?: boolean;
150
+ defaultShowIndividualPoints?: boolean;
151
+ defaultShowSidebar?: boolean;
31
152
  defaultLineWidth?: number;
32
- bodyHeight?: number;
33
- dragPositionYOffset?: number;
34
- syncPool?: any;
153
+
154
+ tooltipOptions?: TooltipOptions;
155
+ annotations?: Annotation[];
156
+ draggablePoints?: DraggablePoint[];
157
+ verticalLines?: VerticalLine[];
35
158
  }
36
159
 
37
160
  export interface MultiGrapherProps extends GrapherProps {
@@ -43,21 +166,23 @@ export interface MultiGrapherProps extends GrapherProps {
43
166
 
44
167
  export interface RangeSelectionProps {
45
168
  stateController: any;
46
- customBoundsSelectors?: any[];
169
+ customBoundsSelectors?: CustomBoundsSelector[];
47
170
  customBoundsSelectorsOnly?: boolean;
48
171
  sidebarEnabled?: boolean;
49
172
  }
50
173
 
51
174
  export interface SyncPoolOptions {
52
175
  syncBounds?: boolean;
53
- syncTooltips?: boolean;
176
+ syncTooltips?: boolean | 'onShift';
54
177
  syncDragState?: boolean;
55
178
  }
56
179
 
57
180
  declare const Grapher: React.ComponentType<GrapherProps>;
58
181
  declare const MultiGrapher: React.ComponentType<MultiGrapherProps>;
59
182
  declare const RangeSelection: React.ComponentType<RangeSelectionProps>;
60
- declare const SyncPool: any;
183
+ declare const SyncPool: {
184
+ new (options?: SyncPoolOptions): any;
185
+ };
61
186
 
62
187
  export const AVAILABLE_COLORS: string[];
63
188
  export const BUILT_IN_BOUND_CALCULATORS: Record<string, (globalBounds?: any) => any>;