@windborne/grapher 1.0.24 → 1.0.26

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/readme.md +180 -263
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windborne/grapher",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "Graphing library",
5
5
  "main": "src/index.js",
6
6
  "module": "dist/bundle.esm.js",
package/readme.md CHANGED
@@ -1,19 +1,23 @@
1
1
 
2
2
  # WindBorne Grapher
3
+
4
+ [![npm version](https://img.shields.io/npm/v/@windborne/grapher.svg)](https://www.npmjs.com/package/@windborne/grapher)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@windborne/grapher.svg)](https://www.npmjs.com/package/@windborne/grapher)
6
+
3
7
  Powerful, performant graphing.
4
8
 
5
- Grapher is designed primarily for internal infrastructure with lots of data and lots of axes.
9
+ **Grapher** is designed primarily for internal infrastructure with lots of data and lots of axes.
6
10
  Key features include:
7
- - Performance. Grapher can render a million points in 100ms and support new data coming in at hundreds of points per second without degraded performance.
8
- - Async data sources. Grapher supports observables directly as well as generator functions to generate data on the fly
9
- - Axis management. Series can be moved between axes and new axes created with ease.
10
- - Long data ranges.
11
+ - *Performance*. Grapher can render a million points in 100ms and support new data coming in at hundreds of points per second without degraded performance.
12
+ - *Async data sources*. Grapher supports observables directly as well as generator functions to generate data on the fly
13
+ - *Axis management*. Series can be moved between axes and new axes created with ease.
14
+ - *Long data ranges*.
11
15
 
12
16
  You _shouldn't_ use this package if:
13
- - You need to support older browsers. While it may work in older browsers, no guarantees are made.
17
+ - *You need to support older browsers*. While it may work in older browsers, no guarantees are made.
14
18
  New features will be used as they become available without regard for maintaining legacy support.
15
- - You don't want to add a react dependency (though the rendering engine may be used without react).
16
- - Asset size is a big concern. Despite not having dependencies, this is a relatively heavy engine compared to alternatives.
19
+ - *You don't want to add a react dependency* (though the rendering engine may be used without react).
20
+ - *Asset size is a big concern*. Despite not having dependencies, this is a relatively heavy engine compared to alternatives.
17
21
 
18
22
  ## As a developer importing this package
19
23
 
@@ -48,63 +52,12 @@ You can find a full list in the package.json devDependencies, but they can be su
48
52
 
49
53
  # Grapher Component
50
54
 
51
- ## Props
52
- Like any React component, Grapher is primarily configured via props.
53
- Refer to the Grapher PropTypes for complete type information.
54
-
55
- ### Core Props
56
-
57
- **series** (required)
58
- This sets the data for the graph and is the only property that is truly required.
59
- See "Series" section for more details.
60
-
61
- **webgl**
62
- If true, will render with WebGL rather than a 2D context.
63
- This is more performant, but uses more resources.
64
-
65
- **requireWASM**
66
- If true, will wait until the WASM extensions are ready before it renders.
67
- This can be useful when your app has expensive initialization.
68
-
69
- ### Series Format
70
- The `series` prop requires an array of objects, where each object represents a data series with the following properties:
71
-
72
- - **data** (required): The actual data points (see Data Formats below)
73
- - **type**: Data type or 'infer' to automatically detect
74
- - **xKey**: Property name for x-values when using object data
75
- - **yKey**: Property name for y-values when using object data
76
- - **xUnixDates**: Whether x-values are Unix timestamps (boolean)
77
- - **color**: Series color (string or number)
78
- - **name**: Series name for display in legend
79
- - **xLabel**: Label for x-axis
80
- - **yLabel**: Label for y-axis
81
- - **rendering**: Visual representation ('line', 'bar', 'area', or 'shadow', defaults to 'line'). The 'shadow' option creates an area chart with individual point-based (trapezoid) gradients extending downward.
82
- - **ignoreDiscontinuities**: Whether to connect points across gaps (boolean)
83
- - **dashed**: Whether to use dashed lines (boolean)
84
- - **dashPattern**: Array defining dash pattern (array of numbers)
85
- - **width**: Line width (number)
86
- - **axis**: Axis specification for the series (string or object)
87
- - **rangeSelectorWidth**: Width of the range selector for this series (number)
88
- - **expandYWith**: Values to include when calculating y-axis range (array of numbers)
89
- - **defaultAlwaysTooltipped**: Whether to always show tooltip for this series (boolean)
90
- - **square**: Whether to render the series with square points (boolean)
91
- - **shiftXBy**: Value to shift x-coordinates by (number)
92
- - **graph**: Affects which graph this series belongs to in multigrapher (number)
93
- - **background**: Background configuration (object)
94
- - **hideFromKey**: Whether to hide this series from the legend (boolean)
95
- - **showIndividualPoints**: Whether to show individual data points (boolean)
96
- - **negativeColor**: Color for negative values
97
- - **gradient**: Gradient configuration, only applies to area rendering (array)
98
- - **zeroLineWidth**: Width of the zero line, only applies to bar and area rendering (number)
99
- - **zeroLineColor**: Color of the zero line, only applies to bar and area rendering (string)
100
- - **zeroLineY**: Y-coordinate of the zero line, only applies to bar and area rendering (number or "bottom"). Defaults to zero; may also be the string "bottom".
101
- - **pointRadius**: Radius of points, only applies to area rendering (number)
102
- - **tooltipWidth**: Expected width of the tooltip (number). Will make the tooltip switch sides when this width plus the tooltip left position is greater than the graph width.
103
- - **hasAreaBottom**: read the bottom of the area from data (boolean). By default, the bottom of an area will just be zero; this allows changing that via passing in `[[x1, bottom], [x1, top], [x2, bottom], [x2, top]]` to data (see [examples/dynamic_bottom_area_chart.js](examples/dynamic_bottom_area_chart.js)).
104
- - **shadowColor**: color of the shadow (string)
105
- - **rangeKey**: if provided, will draw range bars (string). The range value should be of shape `{min: number, max: number}`. Not compatible with webgl.
106
-
107
- #### Series Data Formats
55
+ ### Props
56
+
57
+ Like any other React component, Grapher is primarily configured via props. Refer to the [GrapherProps](#grapherprops) schema for complete type information.
58
+
59
+ ### Series Data Formats
60
+
108
61
  Grapher supports multiple data formats within a series:
109
62
 
110
63
  1. **Array of y-values**: Simple array where index is used as x-value
@@ -113,204 +66,168 @@ Grapher supports multiple data formats within a series:
113
66
  4. **Observable**: Object with an observe method, which may emit tuples or objects
114
67
  5. **Generator function**: Function that generates an array data points as a function of zoom
115
68
 
116
- ### Event Handlers
117
-
118
- **onAxisChange**
119
- If passed in, this function will be called every time the axes change.
120
- It will be called with an array of objects, where each object is a single series object with the `axis`
121
- property set to {left, right}-{index}. This can be useful for saving state between reloads.
122
-
123
- **onRenderTime**
124
- If passed in, this function will be called every time the grapher renders.
125
- It will be called with diagnostic information about how long rendering took.
126
-
127
- **onPointDrag**
128
- Callback function that fires when draggable points are moved.
129
-
130
- **onDraggablePointsDoubleClick**
131
- Callback function that fires when draggable points are double-clicked.
132
-
133
- **timingFrameCount**
134
- Sets the number of frames for when the state controller's `averageLoopTime` method is called.
135
-
136
- ### Appearance
137
-
138
- **theme**
139
- Sets the theme of grapher to either 'day', 'night', or 'export'.
140
- You can also override any CSS property directly in a stylesheet.
141
-
142
- **title**
143
- Sets the title text for the graph.
144
-
145
- **fullscreen**
146
- If true, displays the graph in fullscreen mode.
147
-
148
- **bodyHeight**
149
- Sets the height of the graph body (i.e., excluding range graph, series controls, etc.).
150
-
151
- **height**
152
- Sets the height of the entire graph.
153
-
154
- **width**
155
- Sets the width of the graph.
156
-
157
- ### Display Options
158
-
159
- **showAxes**
160
- Whether to show the axes on the graph.
161
-
162
- **showRangeGraph**
163
- Whether to show the smaller range graph below the main graph.
164
-
165
- **showRangeSelectors**
166
- Whether to show the top bar with range selection (e.g., "last day" button) and other options.
167
-
168
- **showSeriesKey**
169
- Whether to show the key of which series have which colors.
170
-
171
- **showTooltips**
172
- Whether to display tooltips when hovering over data points.
173
-
174
- **showGrid**
175
- Whether to show grid lines on the graph.
176
-
177
- **showAxisColors**
178
- Whether to color-code axes based on the series they represent.
179
-
180
- **bigLabels**
181
- If true, uses larger text for labels.
182
-
183
- **xTickUnit**
184
- Specifies the unit for x-axis ticks. Currently supports 'year'.
185
-
186
- **xAxisIntegersOnly**
187
- If true, only displays integer values on the x-axis.
188
-
189
- **formatXAxisLabel**
190
- A custom function to format the x-axis labels. This function should take a single argument (the raw x-value) and return a string to display as the label.
191
-
192
- **clockStyle**
193
- Format for displaying time, either '12h' or '24h'.
194
-
195
- **timeZone**
196
- Time zone for date/time display. Can be 'local', 'utc', or a full timezone string.
197
-
198
- **markRangeGraphDates**
199
- Whether to mark significant dates on the range graph.
200
-
201
- **tooltipOptions**
202
- Configures tooltip appearance and behavior with properties including:
203
- - `includeSeriesLabel`: Whether to show series name in tooltip
204
- - `includeXLabel`: Whether to show x-axis label in tooltip
205
- - `includeYLabel`: Whether to show y-axis label in tooltip
206
- - `includeXValue`: Whether to show x-axis value in tooltip
207
- - `includeYValue`: Whether to show y-axis value in tooltip
208
- - `floating`: Whether tooltip floats or is fixed position
209
- - `alwaysFixedPosition`: Forces tooltip to always use fixed position
210
- - `floatPosition`: Placement of floating tooltip ('top' or 'bottom')
211
- - `floatDelta`: Pixel offset for floating tooltip positioning
212
- - `savingDisabled`: Prevents tooltip settings from being saved
213
- - `customTooltip`: A react component to use as a custom tooltip. See [examples/custom_tooltips_graph.js](examples/custom_tooltips_graph.js) for an example. If used in conjunction with `combineTooltips`, see [examples/combined_tooltips_graph.js](examples/combined_tooltips_graph.js)
214
- - `combineTooltips`: If true, combines multiple tooltips into one when multiple series are shown. Can alternatively be set to a threshold in pixels for how close values need to be in order to be combined.
215
-
216
- **customBoundsSelectors**
217
- Array of custom range selector objects with properties:
218
- - `label`: Display text for the selector
219
- - `calculator`: Function that determines the bounds
220
- - `datesOnly`: If true, only works with date values
221
-
222
- **customBoundsSelectorsOnly**
223
- If true, only displays custom bounds selectors.
224
-
225
- **defaultBoundsCalculator**
226
- String identifier for the default bounds calculator to use.
227
-
228
- **defaultShowOptions**
229
- Default visibility of the options panel.
230
-
231
- **defaultShowIndividualPoints**
232
- Default setting for showing individual data points.
233
-
234
- **defaultShowSidebar**
235
- Default visibility of the sidebar.
236
-
237
- **defaultShowAnnotations**
238
- Default visibility of annotations.
239
-
240
- **defaultLineWidth**
241
- Default width of the lines in the graph.
242
-
243
- **boundsSelectionEnabled**
244
- Whether to enable the bounds selection feature.
245
-
246
- **sidebarEnabled**
247
- Whether to enable the sidebar.
248
-
249
- **percentile**
250
- Sets the percentile value for calculations.
251
-
252
-
253
- ### Advanced Features
254
-
255
- **tooltipOptions**
256
- Configures tooltip appearance and behavior with properties including:
257
- - `includeSeriesLabel`: Whether to show series name in tooltip
258
- - `includeXLabel`: Whether to show x-axis label in tooltip
259
- - `includeYLabel`: Whether to show y-axis label in tooltip
260
- - `includeXValue`: Whether to show x-axis value in tooltip
261
- - `includeYValue`: Whether to show y-axis value in tooltip
262
- - `floating`: Whether tooltip floats or is fixed position
263
- - `alwaysFixedPosition`: Forces tooltip to always use fixed position
264
- - `floatPosition`: Placement of floating tooltip ('top' or 'bottom')
265
- - `floatDelta`: Pixel offset for floating tooltip positioning
266
- - `savingDisabled`: Prevents tooltip settings from being saved
267
-
268
- **customBoundsSelectors**
269
- Array of custom range selector objects with properties:
270
- - `label`: Display text for the selector
271
- - `calculator`: Function that determines the bounds
272
- - `datesOnly`: If true, only works with date values
273
-
274
- **customBoundsSelectorsOnly**
275
- If true, only displays custom bounds selectors.
276
-
277
- **defaultBoundsCalculator**
278
- String identifier for the default bounds calculator to use.
279
-
280
- **annotations**
281
- Array of annotation objects to display on the graph with properties:
282
- - `x`: Position on x-axis (string, number, or Date) where annotation should appear
283
- - `xEnd`: Optional end position for range annotations
284
- - `series`: Optional array of series names the annotation applies to
285
- - `content`: Text content of the annotation
286
-
287
- **draggablePoints**
288
- Array of interactive point objects with properties:
289
- - `x`: X-coordinate position
290
- - `y`: Y-coordinate position
291
- - `radius`: Optional size of the point
292
- - `fillColor`: Optional interior color
293
- - `strokeColor`: Optional outline color
294
- - `strokeWidth`: Optional outline width
295
- - `onClick`: Optional click handler function
296
- - `onDoubleClick`: Optional double-click handler function
297
-
298
- **verticalLines**
299
- Array of vertical line objects to display on the graph with properties:
300
- - `x`: X-coordinate position where the line should appear
301
- - `color`: Optional line color
302
- - `width`: Optional line width
303
- - `markTop`: Whether to add a marker at the top of the line
304
- - `style`: Optional styling object for the line
305
- - `markerStyle`: Optional styling object for the marker
306
- - `lineTop`: Optional value to specify the top position of the line
307
- - `text`: Optional text to display alongside the line
308
- - `textTop`: Optional value to specify the vertical position of the text
309
- - `textStyle`: Optional styling object for the text
310
- - `minPixelX`: Optional number. If the x position of the line in pixels is less than this value, the line will be hidden
311
- - `maxPixelX`: Optional number. If the x position of the line in pixels is greater than this value, the line will be hidden
312
- - `onRangeGraph`: If true, will show the line on the range graph as well. This may also be an object with any of the above options to adjust the styling
313
- - `onRangeGraphOnly`: If true, the vertical line will only appear on the range graph and not the primary graph
69
+ ### <a id="grapherprops"></a>Schema `GrapherProps`
70
+
71
+ | Prop | Type | Required | Description |
72
+ |------|------|----------|-------------|
73
+ | **series** | [SeriesData](#seriesdata)`[]` | **✓** | The data for the graph and is the only property that is truly required. See "Series Data Formats" section for more details. |
74
+ | id | `string` | | Unique identifier for the grapher instance. |
75
+ | webgl | `boolean` | ✗ | If true, will render with WebGL rather than a 2D context. This is more performant, but uses more resources. |
76
+ | requireWASM | `boolean` | ✗ | If true, will wait until the WASM extensions are ready before it renders. This can be useful when your app has expensive initialization. |
77
+ | checkIntersection | `boolean` | | Controls intersection observer usage for performance optimization. |
78
+ | onAxisChange | `(axes: any) => void` | ✗ | Called every time the axes change. Receives an array of objects with the `axis` property set to {left, right}-{index}. Useful for saving state between reloads. |
79
+ | onRenderTime | `(time: number) => void` | ✗ | Called every time the grapher renders with diagnostic information about how long rendering took. |
80
+ | exportStateController | `(controller: any) => void` | ✗ | Callback that receives the state controller instance for external manipulation. |
81
+ | onPointDrag | `(point: any) => void` | ✗ | Callback function that fires when draggable points are moved. |
82
+ | onDraggablePointsDoubleClick | `(point: any) => void` | ✗ | Callback function that fires when draggable points are double-clicked. |
83
+ | onPointClick | `(point: any) => void` | ✗ | Click handler for data points. |
84
+ | timingFrameCount | `number` | ✗ | Sets the number of frames for when the state controller's `averageLoopTime` method is called. |
85
+ | stateControllerInitialization | `object` | ✗ | Options for initializing the internal state controller. |
86
+ | syncPool | `SyncPool` | ✗ | For synchronizing with other grapher instances. |
87
+ | dragPositionYOffset | `number` | | Y-offset for drag positioning, used in multigrapher. |
88
+ | theme | `'day' \| 'night' \| 'export'` | ✗ | Sets the theme of grapher. You can also override any CSS property directly in a stylesheet. |
89
+ | title | `string` | ✗ | Sets the title text for the graph. |
90
+ | fullscreen | `boolean` | ✗ | If true, displays the graph in fullscreen mode. |
91
+ | bodyHeight | `number` | ✗ | Sets the height of the graph body (i.e., excluding range graph, series controls, etc.). |
92
+ | height | `number \| string` | | Sets the height of the entire graph. |
93
+ | width | `number \| string` | | Sets the width of the graph. |
94
+ | showAxes | `boolean` | ✗ | Whether to show the axes on the graph. |
95
+ | showRangeGraph | `boolean` | ✗ | Whether to show the smaller range graph below the main graph. |
96
+ | showRangeSelectors | `boolean` | ✗ | Whether to show the top bar with range selection (e.g., "last day" button) and other options. |
97
+ | showSeriesKey | `boolean` | ✗ | Whether to show the key of which series have which colors. |
98
+ | showTooltips | `boolean` | ✗ | Whether to display tooltips when hovering over data points. |
99
+ | showGrid | `boolean` | | Whether to show grid lines on the graph. |
100
+ | showAxisColors | `boolean` | ✗ | Whether to color-code axes based on the series they represent. |
101
+ | bigLabels | `boolean` | ✗ | If true, uses larger text for labels. |
102
+ | xTickUnit | `'year'` | | Specifies the unit for x-axis ticks. Currently supports 'year'. |
103
+ | formatXAxisLabel | `(value: any) => string` | ✗ | A custom function to format the x-axis labels. This function should take a single argument (the raw x-value) and return a string to display as the label. |
104
+ | xAxisIntegersOnly | `boolean` | ✗ | If true, only displays integer values on the x-axis. |
105
+ | clockStyle | `'12h' \| '24h'` | ✗ | Format for displaying time, either '12h' or '24h'. |
106
+ | timeZone | `string` | ✗ | Time zone for date/time display. Can be 'local', 'utc', or a full timezone string. |
107
+ | markRangeGraphDates | `boolean` | ✗ | Whether to mark significant dates on the range graph. |
108
+ | boundsSelectionEnabled | `boolean` | ✗ | Whether to enable the bounds selection feature. |
109
+ | customBoundsSelectors | [CustomBoundsSelector](#customboundsselector)`[]` | ✗ | Array of custom range selector objects with label, calculator, and optional datesOnly properties. |
110
+ | customBoundsSelectorsOnly | `boolean` | ✗ | If true, only displays custom bounds selectors. |
111
+ | sidebarEnabled | `boolean` | ✗ | Whether to enable the sidebar. |
112
+ | defaultBoundsCalculator | `string` | ✗ | String identifier for the default bounds calculator to use. |
113
+ | percentile | `number` | | Sets the percentile value for calculations. |
114
+ | defaultShowAnnotations | `boolean` | ✗ | Default visibility of annotations. |
115
+ | defaultShowOptions | `boolean` | ✗ | Default visibility of the options panel. |
116
+ | defaultShowIndividualPoints | `boolean` | | Default setting for showing individual data points. |
117
+ | defaultShowSidebar | `boolean` | ✗ | Default visibility of the sidebar. |
118
+ | defaultLineWidth | `number` | ✗ | Default width of the lines in the graph. |
119
+ | tooltipOptions | [TooltipOptions](#tooltipoptions) | | Configures tooltip appearance and behavior with various options. |
120
+ | annotations | [Annotation](#annotation)`[]` | ✗ | Array of annotation objects to display on the graph with position, content, and series targeting. |
121
+ | draggablePoints | [DraggablePoint](#draggablepoint)`[]` | ✗ | Array of interactive point objects with position, styling, and event handlers. |
122
+ | verticalLines | [VerticalLine](#verticalline)`[]` | ✗ | Array of vertical line objects to display on the graph with position, styling, and text options. |
123
+
124
+ ### <a id="seriesdata"></a>Schema `SeriesData`
125
+
126
+ | Prop | Type | Required | Description |
127
+ |------|------|----------|-------------|
128
+ | **data** | `any[] \| Observable \| Function` | **✓** | The actual data points (see Data Formats section). |
129
+ | type | `'values' \| 'tuples' \| 'objects' \| 'tuple_observable' \| 'object_observable' \| 'infer'` | ✗ | Data type or 'infer' to automatically detect. |
130
+ | xKey | `string` | ✗ | Property name for x-values when using object data. |
131
+ | yKey | `string` | | Property name for y-values when using object data. |
132
+ | xUnixDates | `boolean` | ✗ | Whether x-values are Unix timestamps. |
133
+ | color | `string \| number` | ✗ | Series color (string or number). |
134
+ | name | `string` | ✗ | Series name for display in legend. |
135
+ | xLabel | `string` | ✗ | Label for x-axis. |
136
+ | yLabel | `string` | ✗ | Label for y-axis. |
137
+ | rendering | `'line' \| 'bar' \| 'area' \| 'shadow'` | ✗ | Visual representation (defaults to 'line'). The 'shadow' option creates an area chart with individual point-based trapezoid gradients extending downward. |
138
+ | ignoreDiscontinuities | `boolean` | ✗ | Whether to connect points across gaps. |
139
+ | dashed | `boolean` | ✗ | Whether to use dashed lines. |
140
+ | dashPattern | `number[]` | | Array defining dash pattern. |
141
+ | width | `number` | ✗ | Line width. |
142
+ | axis | `string \| object` | ✗ | Axis specification for the series. |
143
+ | rangeSelectorWidth | `number` | | Width of the range selector for this series. |
144
+ | expandYWith | `number[]` | ✗ | Values to include when calculating y-axis range. |
145
+ | defaultAlwaysTooltipped | `boolean` | ✗ | Whether to always show tooltip for this series. |
146
+ | square | `boolean` | | Whether to render the series with square points. |
147
+ | shiftXBy | `number` | ✗ | Value to shift x-coordinates by. |
148
+ | graph | `number` | ✗ | Affects which graph this series belongs to in multigrapher. |
149
+ | background | `object` | | Background configuration. |
150
+ | hideFromKey | `boolean` | ✗ | Whether to hide this series from the legend. |
151
+ | showIndividualPoints | `boolean` | ✗ | Whether to show individual data points. |
152
+ | negativeColor | `string` | | Color for negative values. |
153
+ | gradient | `string[] \| [number, string][]` | ✗ | Gradient configuration, only applies to area rendering. |
154
+ | zeroLineWidth | `number` | ✗ | Width of the zero line, only applies to bar and area rendering. |
155
+ | zeroLineColor | `string` | ✗ | Color of the zero line, only applies to bar and area rendering. |
156
+ | zeroLineY | `number \| 'bottom'` | ✗ | Y-coordinate of the zero line, only applies to bar and area rendering. Defaults to zero; may also be the string "bottom". |
157
+ | pointRadius | `number` | | Radius of points, only applies to area rendering. |
158
+ | tooltipWidth | `number` | | Expected width of the tooltip. Will make the tooltip switch sides when this width plus the tooltip left position is greater than the graph width. |
159
+ | hasAreaBottom | `boolean` | | Read the bottom of the area from data. By default, the bottom of an area will just be zero; this allows changing that via passing in `[[x1, bottom], [x1, top], [x2, bottom], [x2, top]]` to data. |
160
+ | shadowColor | `string` | | Color of the shadow. |
161
+ | rangeKey | `string` | | If provided, will draw range bars. The range value should be of shape `{min: number, max: number}`. Not compatible with webgl. |
162
+ | cutoffTime | `number \| Date \| 'now'` | | Creates visual cutoff effects in line, area, bar, and shadow renderings. Can be a timestamp, Date object, or 'now' for current time. |
163
+
164
+ ### <a id="tooltipoptions"></a>Schema `TooltipOptions`
165
+
166
+ | Prop | Type | Required | Description |
167
+ |------|------|----------|-------------|
168
+ | includeSeriesLabel | `boolean` | ✗ | Whether to show series name in tooltip. |
169
+ | includeXLabel | `boolean` | ✗ | Whether to show x-axis label in tooltip. |
170
+ | includeYLabel | `boolean` | | Whether to show y-axis label in tooltip. |
171
+ | includeXValue | `boolean` | | Whether to show x-axis value in tooltip. |
172
+ | includeYValue | `boolean` | | Whether to show y-axis value in tooltip. |
173
+ | floating | `boolean` | | Whether tooltip floats or is fixed position. |
174
+ | alwaysFixedPosition | `boolean` | ✗ | Forces tooltip to always use fixed position. |
175
+ | floatPosition | `'top' \| 'bottom'` | ✗ | Placement of floating tooltip. |
176
+ | floatDelta | `number` | | Pixel offset for floating tooltip positioning. |
177
+ | savingDisabled | `boolean` | ✗ | Prevents tooltip settings from being saved. |
178
+ | customTooltip | `React.ComponentType<any>` | ✗ | A react component to use as a custom tooltip. If used in conjunction with `combineTooltips`, see combined tooltips examples. |
179
+ | combineTooltips | `boolean \| number` | ✗ | If true, combines multiple tooltips into one when multiple series are shown. Can alternatively be set to a threshold in pixels for how close values need to be in order to be combined. |
180
+
181
+ ### <a id="customboundsselector"></a>Schema `CustomBoundsSelector`
182
+
183
+ | Prop | Type | Required | Description |
184
+ |------|------|----------|-------------|
185
+ | **label** | `string` | **✓** | Display text for the selector. |
186
+ | **calculator** | `(globalBounds?: any) => any` | **✓** | Function that determines the bounds. |
187
+ | datesOnly | `boolean` | ✗ | If true, only works with date values. |
188
+
189
+ ### <a id="annotation"></a>Schema `Annotation`
190
+
191
+ | Prop | Type | Required | Description |
192
+ |------|------|----------|-------------|
193
+ | x | `string \| number \| Date` | ✗ | Position on x-axis where annotation should appear. |
194
+ | startX | `string \| number \| Date` | ✗ | Start position for range annotations. |
195
+ | endX | `string \| number \| Date` | ✗ | End position for range annotations. |
196
+ | series | `string[]` | ✗ | Optional array of series names the annotation applies to. |
197
+ | content | `string` | | Text content of the annotation. |
198
+ | lineOnly | `boolean` | ✗ | Shows only the line portion of annotations without background/content areas. |
199
+
200
+ ### <a id="draggablepoint"></a>Schema `DraggablePoint`
201
+
202
+ | Prop | Type | Required | Description |
203
+ |------|------|----------|-------------|
204
+ | **x** | `number` | **✓** | X-coordinate position. |
205
+ | **y** | `number` | **✓** | Y-coordinate position. |
206
+ | radius | `number` | ✗ | Optional size of the point. |
207
+ | fillColor | `string` | ✗ | Optional interior color. |
208
+ | strokeColor | `string` | ✗ | Optional outline color. |
209
+ | strokeWidth | `number` | | Optional outline width. |
210
+ | onClick | `(point: `[DraggablePoint](#draggablepoint)`) => void` | | Optional click handler function. |
211
+ | onDoubleClick | `(point: `[DraggablePoint](#draggablepoint)`) => void` | ✗ | Optional double-click handler function. |
212
+
213
+ ### <a id="verticalline"></a>Schema `VerticalLine`
214
+
215
+ | Prop | Type | Required | Description |
216
+ |------|------|----------|-------------|
217
+ | **x** | `number` | **✓** | X-coordinate position where the line should appear. |
218
+ | color | `string` | | Optional line color. |
219
+ | lineTop | `number` | | Optional value to specify the top position of the line. |
220
+ | width | `number` | ✗ | Optional line width. |
221
+ | markTop | `boolean` | ✗ | Whether to add a marker at the top of the line. |
222
+ | style | `object` | | Optional styling object for the line. |
223
+ | markerStyle | `object` | | Optional styling object for the marker. |
224
+ | text | `string` | | Optional text to display alongside the line. |
225
+ | textTop | `number` | | Optional value to specify the vertical position of the text. |
226
+ | textStyle | `object` | ✗ | Optional styling object for the text. |
227
+ | minPixelX | `number` | ✗ | If the x position of the line in pixels is less than this value, the line will be hidden. |
228
+ | maxPixelX | `number` | ✗ | If the x position of the line in pixels is greater than this value, the line will be hidden. |
229
+ | onRangeGraph | `boolean \| object` | ✗ | If true, will show the line on the range graph as well. This may also be an object with any of the above options to adjust the styling. |
230
+ | onRangeGraphOnly | `boolean` | ✗ | If true, the vertical line will only appear on the range graph and not the primary graph. |
314
231
 
315
232
  ## Developing
316
233
  Other than an `npm install`, you'll need to install rust and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/).