lightweight-charts-react-components 1.4.1 → 2.1.0
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.
- package/README.md +33 -2
- package/dist/index.d.ts +212 -100
- package/dist/lightweight-charts-react-components.mjs +4 -4
- package/dist/lightweight-charts-react-components.mjs.map +1 -1
- package/dist/lightweight-charts-react-components.standalone.js +2 -2
- package/dist/lightweight-charts-react-components.standalone.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
</picture>
|
|
32
32
|
</a>
|
|
33
33
|
|
|
34
|
+
<a href="https://pkg.pr.new/~/ukorvl/lightweight-charts-react-components">
|
|
35
|
+
<img src="https://pkg.pr.new/badge/ukorvl/lightweight-charts-react-components" alt="pkg.pr.new">
|
|
36
|
+
</a>
|
|
37
|
+
|
|
34
38
|
<a href="https://github.com/ukorvl/lightweight-charts-react-components/blob/main/LICENSE">
|
|
35
39
|
<picture>
|
|
36
40
|
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/lightweight-charts-react-components?colorA=1e2029&colorB=1e2029&style=flat">
|
|
@@ -94,22 +98,49 @@ Check out the [Demo](https://ukorvl.github.io/lightweight-charts-react-component
|
|
|
94
98
|
|
|
95
99
|
## Table of Contents
|
|
96
100
|
|
|
101
|
+
- [Description](#description)
|
|
102
|
+
- [Table of Contents](#table-of-contents)
|
|
97
103
|
- [Installation](#installation)
|
|
104
|
+
- [Stable release](#stable-release)
|
|
105
|
+
- [Preview builds](#preview-builds)
|
|
106
|
+
- [Standalone browser build](#standalone-browser-build)
|
|
98
107
|
- [Usage](#usage)
|
|
108
|
+
- [Chart Container Sizing](#chart-container-sizing)
|
|
99
109
|
- [Examples](#examples)
|
|
100
110
|
- [Contributing](#contributing)
|
|
111
|
+
- [How to Contribute](#how-to-contribute)
|
|
101
112
|
- [Related Projects](#related-projects)
|
|
102
113
|
- [License](#license)
|
|
103
114
|
|
|
104
115
|
## Installation
|
|
105
116
|
|
|
106
|
-
|
|
117
|
+
### Stable release
|
|
118
|
+
|
|
119
|
+
Install the latest published version from npm:
|
|
107
120
|
|
|
108
121
|
```bash
|
|
109
122
|
npm install lightweight-charts-react-components lightweight-charts
|
|
110
123
|
```
|
|
111
124
|
|
|
112
|
-
|
|
125
|
+
### Preview builds
|
|
126
|
+
|
|
127
|
+
To test the latest unreleased version from `main`, install the preview build published via `pkg.pr.new`:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm install https://pkg.pr.new/lightweight-charts-react-components@main lightweight-charts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or choose a specific commit from `main` and install the preview build for that commit:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm install https://pkg.pr.new/lightweight-charts-react-components@<commit-hash> lightweight-charts
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For security reasons, preview builds are published only from commits pushed to `main`. Pull request builds are not published.
|
|
140
|
+
|
|
141
|
+
### Standalone browser build
|
|
142
|
+
|
|
143
|
+
The standalone version is also available for use in the browser without a build step. The library expects global `React`, `ReactDOM`, and `LightweightCharts` variables to be available in the global scope.
|
|
113
144
|
|
|
114
145
|
```html
|
|
115
146
|
<head>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**!
|
|
3
|
-
* lightweight-charts-react-components
|
|
3
|
+
* lightweight-charts-react-components v2.1.0
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE.md file in the root directory of this source tree.
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { ChartOptions } from 'lightweight-charts';
|
|
12
|
+
import { ChartOptionsImpl } from 'lightweight-charts';
|
|
12
13
|
import { DeepPartial } from 'lightweight-charts';
|
|
13
14
|
import type { DependencyList } from 'react';
|
|
14
15
|
import type { ForwardedRef } from 'react';
|
|
15
16
|
import type { ForwardRefExoticComponent } from 'react';
|
|
16
17
|
import { IChartApi } from 'lightweight-charts';
|
|
18
|
+
import { IChartApiBase } from 'lightweight-charts';
|
|
17
19
|
import type { ICustomSeriesPaneView } from 'lightweight-charts';
|
|
20
|
+
import { IHorzScaleBehavior } from 'lightweight-charts';
|
|
18
21
|
import type { IImageWatermarkPluginApi } from 'lightweight-charts';
|
|
19
22
|
import type { ImageWatermarkOptions } from 'lightweight-charts';
|
|
20
23
|
import type { IPaneApi } from 'lightweight-charts';
|
|
@@ -26,11 +29,14 @@ import type { ISeriesMarkersPluginApi } from 'lightweight-charts';
|
|
|
26
29
|
import type { ISeriesPrimitive } from 'lightweight-charts';
|
|
27
30
|
import type { ITextWatermarkPluginApi } from 'lightweight-charts';
|
|
28
31
|
import type { ITimeScaleApi } from 'lightweight-charts';
|
|
32
|
+
import { IYieldCurveChartApi } from 'lightweight-charts';
|
|
29
33
|
import type { JSX } from 'react';
|
|
30
34
|
import type { LogicalRangeChangeEventHandler } from 'lightweight-charts';
|
|
31
35
|
import { MouseEventHandler } from 'lightweight-charts';
|
|
36
|
+
import { PriceChartOptions } from 'lightweight-charts';
|
|
32
37
|
import type { PriceLineOptions } from 'lightweight-charts';
|
|
33
38
|
import type { PriceScaleOptions as PriceScaleOptions_2 } from 'lightweight-charts';
|
|
39
|
+
import type { ReactElement } from 'react';
|
|
34
40
|
import type { ReactNode } from 'react';
|
|
35
41
|
import type { RefAttributes } from 'react';
|
|
36
42
|
import type { SeriesDataItemTypeMap } from 'lightweight-charts';
|
|
@@ -43,6 +49,7 @@ import type { TextWatermarkOptions } from 'lightweight-charts';
|
|
|
43
49
|
import { Time } from 'lightweight-charts';
|
|
44
50
|
import type { TimeRangeChangeEventHandler } from 'lightweight-charts';
|
|
45
51
|
import type { TimeScaleOptions as TimeScaleOptions_2 } from 'lightweight-charts';
|
|
52
|
+
import { YieldCurveChartOptions } from 'lightweight-charts';
|
|
46
53
|
|
|
47
54
|
/**
|
|
48
55
|
* AreaSeries component that can be used to create an area series in a chart.
|
|
@@ -147,22 +154,27 @@ export declare const CandlestickSeries: SeriesForwardRefComponent<"Candlestick">
|
|
|
147
154
|
*/
|
|
148
155
|
export declare const Chart: ForwardRefExoticComponent<ChartProps & RefAttributes<HTMLDivElement>>;
|
|
149
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Common chart API surface used by the React wrapper.
|
|
159
|
+
*/
|
|
160
|
+
declare type ChartApiInstance<HorzScaleItem = Time> = Pick<IChartApiBase<HorzScaleItem>, "applyOptions" | "remove" | "subscribeClick" | "unsubscribeClick" | "subscribeCrosshairMove" | "unsubscribeCrosshairMove" | "subscribeDblClick" | "unsubscribeDblClick">;
|
|
161
|
+
|
|
150
162
|
/**
|
|
151
163
|
* Chart API reference type that can be used to access the chart plugin API.
|
|
152
164
|
*/
|
|
153
|
-
export declare type ChartApiRef = {
|
|
165
|
+
export declare type ChartApiRef<HorzScaleItem = Time, TChartApi extends ChartApiInstance<HorzScaleItem> = ChartApiInstance<HorzScaleItem>> = {
|
|
154
166
|
/**
|
|
155
167
|
* Internal reference to the chart API instance.
|
|
156
168
|
*/
|
|
157
|
-
_chart:
|
|
169
|
+
_chart: TChartApi | null;
|
|
158
170
|
/**
|
|
159
171
|
* Function to get the chart API instance.
|
|
160
172
|
*/
|
|
161
|
-
api: () =>
|
|
173
|
+
api: () => TChartApi | null;
|
|
162
174
|
/**
|
|
163
175
|
* Function to initialize the chart API instance.
|
|
164
176
|
*/
|
|
165
|
-
init: () =>
|
|
177
|
+
init: () => TChartApi | null;
|
|
166
178
|
/**
|
|
167
179
|
* Function to clear the chart API instance.
|
|
168
180
|
*/
|
|
@@ -172,35 +184,37 @@ export declare type ChartApiRef = {
|
|
|
172
184
|
/**
|
|
173
185
|
* Chart component props.
|
|
174
186
|
*/
|
|
175
|
-
export declare type ChartProps =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
187
|
+
export declare type ChartProps = GenericChartProps<Time, IChartApi, ChartOptions>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* CustomChart component that can be used to create a chart with a custom horizontal scale behavior.
|
|
191
|
+
*
|
|
192
|
+
* @param props - The properties for the custom chart.
|
|
193
|
+
* @param ref - The ref to access the chart container.
|
|
194
|
+
* @returns A React component that renders the custom chart.
|
|
195
|
+
* @see {@link https://ukorvl.github.io/lightweight-charts-react-components/docs/chart | Chart documentation}
|
|
196
|
+
* @see {@link https://tradingview.github.io/lightweight-charts/docs/chart-types#custom-horizontal-scale-chart | TradingView documentation for custom horizontal scale charts}
|
|
197
|
+
* @example
|
|
198
|
+
* ```tsx
|
|
199
|
+
* <CustomChart horzScaleBehavior={new (defaultHorzScaleBehavior())()}>
|
|
200
|
+
* <LineSeries data={[{ time: "2025-01-01", value: 100 }]} />
|
|
201
|
+
* </CustomChart>
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare const CustomChart: CustomChartForwardRefComponent;
|
|
205
|
+
|
|
206
|
+
declare type CustomChartForwardRefComponent = (<HorzScaleItem, THorzScaleBehavior extends IHorzScaleBehavior<HorzScaleItem>>(props: CustomChartProps<HorzScaleItem, THorzScaleBehavior> & RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
207
|
+
displayName: string;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* CustomChart component props.
|
|
212
|
+
*/
|
|
213
|
+
export declare type CustomChartProps<HorzScaleItem = Time, THorzScaleBehavior extends IHorzScaleBehavior<HorzScaleItem> = IHorzScaleBehavior<HorzScaleItem>> = GenericChartProps<HorzScaleItem, IChartApiBase<HorzScaleItem>, ReturnType<THorzScaleBehavior["options"]>> & {
|
|
200
214
|
/**
|
|
201
|
-
*
|
|
215
|
+
* Horizontal scale behavior instance passed to `createChartEx`.
|
|
202
216
|
*/
|
|
203
|
-
|
|
217
|
+
horzScaleBehavior: THorzScaleBehavior;
|
|
204
218
|
};
|
|
205
219
|
|
|
206
220
|
/**
|
|
@@ -228,19 +242,71 @@ export declare const CustomSeries: SeriesForwardRefComponent<"Custom">;
|
|
|
228
242
|
/**
|
|
229
243
|
* Unique properties for the custom series component.
|
|
230
244
|
*/
|
|
231
|
-
declare type CustomSeriesUniqueProps = {
|
|
245
|
+
declare type CustomSeriesUniqueProps<HorzScaleItem = Time> = {
|
|
232
246
|
/**
|
|
233
247
|
* Custom pane view plugin instance that can be used to render custom series.
|
|
234
248
|
*/
|
|
235
|
-
plugin?: ICustomSeriesPaneView
|
|
249
|
+
plugin?: ICustomSeriesPaneView<HorzScaleItem>;
|
|
236
250
|
};
|
|
237
251
|
|
|
238
|
-
|
|
239
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Generic chart component props.
|
|
254
|
+
*/
|
|
255
|
+
export declare type GenericChartProps<HorzScaleItem = Time, TChartApi extends ChartApiInstance<HorzScaleItem> = ChartApiInstance<HorzScaleItem>, TOptions extends ChartOptionsImpl<HorzScaleItem> = ChartOptionsImpl<HorzScaleItem>> = {
|
|
256
|
+
/**
|
|
257
|
+
* Children of the chart component.
|
|
258
|
+
*/
|
|
259
|
+
children?: ReactNode;
|
|
260
|
+
/**
|
|
261
|
+
* The props for the container element on which the chart will be rendered.
|
|
262
|
+
*/
|
|
263
|
+
containerProps?: JSX.IntrinsicElements["div"];
|
|
264
|
+
/**
|
|
265
|
+
* Callback function that is called when the chart is clicked.
|
|
266
|
+
*/
|
|
267
|
+
onClick?: MouseEventHandler<HorzScaleItem>;
|
|
268
|
+
/**
|
|
269
|
+
* Callback function that is called when the crosshair moves.
|
|
270
|
+
*/
|
|
271
|
+
onCrosshairMove?: MouseEventHandler<HorzScaleItem>;
|
|
272
|
+
/**
|
|
273
|
+
* Callback function that is called when the chart is initialized.
|
|
274
|
+
*/
|
|
275
|
+
onInit?: (chart: TChartApi) => void;
|
|
276
|
+
/**
|
|
277
|
+
* Options for the chart.
|
|
278
|
+
*/
|
|
279
|
+
options?: DeepPartial<TOptions>;
|
|
280
|
+
/**
|
|
281
|
+
* Callback function that is called when the chart is double-clicked.
|
|
282
|
+
*/
|
|
283
|
+
onDblClick?: MouseEventHandler<HorzScaleItem>;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare type GenericMarkersComponent = (<HorzScaleItem = Time>(props: MarkersProps<HorzScaleItem> & {
|
|
287
|
+
ref?: ForwardedRef<MarkersApiRef<HorzScaleItem>>;
|
|
288
|
+
}) => JSX.Element | null) & {
|
|
289
|
+
displayName: string;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
declare type GenericPaneComponent = (<HorzScaleItem = Time>(props: PaneProps & {
|
|
293
|
+
ref?: ForwardedRef<PaneApiRef<HorzScaleItem>>;
|
|
294
|
+
}) => JSX.Element) & {
|
|
295
|
+
displayName: string;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
declare type GenericSeriesPrimitiveComponent = (<T extends SeriesType, HorzScaleItem = Time>(props: SeriesPrimitiveProps<T, HorzScaleItem> & {
|
|
299
|
+
ref?: ForwardedRef<SeriesPrimitiveApiRef<HorzScaleItem>>;
|
|
240
300
|
}) => ReturnType<typeof SeriesPrimitiveRenderFunction>) & {
|
|
241
301
|
displayName: string;
|
|
242
302
|
};
|
|
243
303
|
|
|
304
|
+
declare type GenericTimeScaleComponent = (<HorzScaleItem = Time>(props: TimeScaleProps<HorzScaleItem> & {
|
|
305
|
+
ref?: ForwardedRef<TimeScaleApiRef<HorzScaleItem>>;
|
|
306
|
+
}) => JSX.Element) & {
|
|
307
|
+
displayName: string;
|
|
308
|
+
};
|
|
309
|
+
|
|
244
310
|
/**
|
|
245
311
|
* HistogramSeries component that can be used to create a histogram series in a chart.
|
|
246
312
|
*
|
|
@@ -272,11 +338,11 @@ export declare type ImageWatermarkProps = {
|
|
|
272
338
|
/**
|
|
273
339
|
* Pane context that provides access to the pane API and readiness state.
|
|
274
340
|
*/
|
|
275
|
-
export declare interface IPaneContext {
|
|
341
|
+
export declare interface IPaneContext<HorzScaleItem = Time> {
|
|
276
342
|
/**
|
|
277
343
|
* Reference to the pane API.
|
|
278
344
|
*/
|
|
279
|
-
paneApiRef?: PaneApiRef
|
|
345
|
+
paneApiRef?: PaneApiRef<HorzScaleItem>;
|
|
280
346
|
/**
|
|
281
347
|
* Readiness state of the pane component.
|
|
282
348
|
*/
|
|
@@ -322,24 +388,24 @@ export declare const LineSeries: SeriesForwardRefComponent<"Line">;
|
|
|
322
388
|
* />
|
|
323
389
|
* ```
|
|
324
390
|
*/
|
|
325
|
-
export declare const Markers:
|
|
391
|
+
export declare const Markers: GenericMarkersComponent;
|
|
326
392
|
|
|
327
393
|
/**
|
|
328
394
|
* Markers API reference type that can be used to access the series markers plugin API.
|
|
329
395
|
*/
|
|
330
|
-
export declare type MarkersApiRef = {
|
|
396
|
+
export declare type MarkersApiRef<HorzScaleItem = Time> = {
|
|
331
397
|
/**
|
|
332
398
|
* Internal reference to the series markers API instance.
|
|
333
399
|
*/
|
|
334
|
-
_markers: ISeriesMarkersPluginApi<
|
|
400
|
+
_markers: ISeriesMarkersPluginApi<HorzScaleItem> | null;
|
|
335
401
|
/**
|
|
336
402
|
* Function to get the series markers API instance.
|
|
337
403
|
*/
|
|
338
|
-
api: () => ISeriesMarkersPluginApi<
|
|
404
|
+
api: () => ISeriesMarkersPluginApi<HorzScaleItem> | null;
|
|
339
405
|
/**
|
|
340
406
|
* Function to initialize the series markers API instance.
|
|
341
407
|
*/
|
|
342
|
-
init: () => ISeriesMarkersPluginApi<
|
|
408
|
+
init: () => ISeriesMarkersPluginApi<HorzScaleItem> | null;
|
|
343
409
|
/**
|
|
344
410
|
* Function to clear the series markers API instance.
|
|
345
411
|
*/
|
|
@@ -349,11 +415,11 @@ export declare type MarkersApiRef = {
|
|
|
349
415
|
/**
|
|
350
416
|
* Markers component properties that can be used to create a series markers component.
|
|
351
417
|
*/
|
|
352
|
-
export declare type MarkersProps = {
|
|
418
|
+
export declare type MarkersProps<HorzScaleItem = Time> = {
|
|
353
419
|
/**
|
|
354
420
|
* List of markers to be displayed on the series.
|
|
355
421
|
*/
|
|
356
|
-
markers: SeriesMarker<
|
|
422
|
+
markers: SeriesMarker<HorzScaleItem>[];
|
|
357
423
|
/**
|
|
358
424
|
* Options for the markers.
|
|
359
425
|
*/
|
|
@@ -364,6 +430,28 @@ export declare type MarkersProps = {
|
|
|
364
430
|
reactive?: boolean;
|
|
365
431
|
};
|
|
366
432
|
|
|
433
|
+
/**
|
|
434
|
+
* OptionsChart component that can be used to create a price-based horizontal scale chart.
|
|
435
|
+
*
|
|
436
|
+
* @param props - The properties for the options chart.
|
|
437
|
+
* @param ref - The ref to access the chart container.
|
|
438
|
+
* @returns A React component that renders the options chart.
|
|
439
|
+
* @see {@link https://ukorvl.github.io/lightweight-charts-react-components/docs/chart | Chart documentation}
|
|
440
|
+
* @see {@link https://tradingview.github.io/lightweight-charts/docs/chart-types#options-chart-price-based | TradingView documentation for options charts}
|
|
441
|
+
* @example
|
|
442
|
+
* ```tsx
|
|
443
|
+
* <OptionsChart>
|
|
444
|
+
* <LineSeries data={[{ time: 95, value: 1.2 }, { time: 100, value: 2.8 }]} />
|
|
445
|
+
* </OptionsChart>
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
export declare const OptionsChart: ForwardRefExoticComponent<OptionsChartProps & RefAttributes<HTMLDivElement>>;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* OptionsChart component props.
|
|
452
|
+
*/
|
|
453
|
+
export declare type OptionsChartProps = GenericChartProps<number, IChartApiBase<number>, PriceChartOptions>;
|
|
454
|
+
|
|
367
455
|
/**
|
|
368
456
|
* Pane component that can be used to create a pane in a chart.
|
|
369
457
|
*
|
|
@@ -379,24 +467,24 @@ export declare type MarkersProps = {
|
|
|
379
467
|
* </Pane>
|
|
380
468
|
* ```
|
|
381
469
|
*/
|
|
382
|
-
export declare const Pane:
|
|
470
|
+
export declare const Pane: GenericPaneComponent;
|
|
383
471
|
|
|
384
472
|
/**
|
|
385
473
|
* Pane API reference type that can be used to access the pane plugin API.
|
|
386
474
|
*/
|
|
387
|
-
export declare type PaneApiRef = {
|
|
475
|
+
export declare type PaneApiRef<HorzScaleItem = Time> = {
|
|
388
476
|
/**
|
|
389
477
|
* Reference to the pane API.
|
|
390
478
|
*/
|
|
391
|
-
_pane: IPaneApi<
|
|
479
|
+
_pane: IPaneApi<HorzScaleItem> | null;
|
|
392
480
|
/**
|
|
393
481
|
* Function to get the pane API.
|
|
394
482
|
*/
|
|
395
|
-
api: () => IPaneApi<
|
|
483
|
+
api: () => IPaneApi<HorzScaleItem> | null;
|
|
396
484
|
/**
|
|
397
485
|
* Function to initialize the pane API.
|
|
398
486
|
*/
|
|
399
|
-
init: () => IPaneApi<
|
|
487
|
+
init: () => IPaneApi<HorzScaleItem> | null;
|
|
400
488
|
/**
|
|
401
489
|
* Function to clear the pane API.
|
|
402
490
|
*/
|
|
@@ -528,27 +616,27 @@ export declare type PriceScaleProps = {
|
|
|
528
616
|
/**
|
|
529
617
|
* Render function type for series primitives.
|
|
530
618
|
*/
|
|
531
|
-
export declare type RenderPrimitive<T extends SeriesType = SeriesType> = ({ chart, series, }: {
|
|
532
|
-
chart:
|
|
533
|
-
series: ISeriesApi<T>;
|
|
534
|
-
}) => ISeriesPrimitive
|
|
619
|
+
export declare type RenderPrimitive<T extends SeriesType = SeriesType, HorzScaleItem = Time> = ({ chart, series, }: {
|
|
620
|
+
chart: IChartApiBase<HorzScaleItem>;
|
|
621
|
+
series: ISeriesApi<T, HorzScaleItem>;
|
|
622
|
+
}) => ISeriesPrimitive<HorzScaleItem>;
|
|
535
623
|
|
|
536
624
|
/**
|
|
537
625
|
* Series API reference type that can be used to access the series plugin API.
|
|
538
626
|
*/
|
|
539
|
-
export declare type SeriesApiRef<T extends SeriesType> = {
|
|
627
|
+
export declare type SeriesApiRef<T extends SeriesType, HorzScaleItem = Time> = {
|
|
540
628
|
/**
|
|
541
629
|
* Internal reference to the series API instance.
|
|
542
630
|
*/
|
|
543
|
-
_series: ISeriesApi<T> | null;
|
|
631
|
+
_series: ISeriesApi<T, HorzScaleItem> | null;
|
|
544
632
|
/**
|
|
545
633
|
* Function to get the series API instance.
|
|
546
634
|
*/
|
|
547
|
-
api: () => ISeriesApi<T> | null;
|
|
635
|
+
api: () => ISeriesApi<T, HorzScaleItem> | null;
|
|
548
636
|
/**
|
|
549
637
|
* Function to initialize the series API instance.
|
|
550
638
|
*/
|
|
551
|
-
init: () => ISeriesApi<T> | null;
|
|
639
|
+
init: () => ISeriesApi<T, HorzScaleItem> | null;
|
|
552
640
|
/**
|
|
553
641
|
* Function to clear the series API instance.
|
|
554
642
|
*/
|
|
@@ -558,26 +646,29 @@ export declare type SeriesApiRef<T extends SeriesType> = {
|
|
|
558
646
|
/**
|
|
559
647
|
* Forward ref component type for a series component.
|
|
560
648
|
*/
|
|
561
|
-
declare type SeriesForwardRefComponent<T extends SeriesType> =
|
|
649
|
+
declare type SeriesForwardRefComponent<T extends SeriesType> = (<HorzScaleItem = Time>(props: SeriesProps<T, HorzScaleItem> & RefAttributes<SeriesApiRef<T, HorzScaleItem>>) => ReactElement | null) & {
|
|
650
|
+
displayName?: string;
|
|
651
|
+
};
|
|
562
652
|
|
|
563
653
|
/**
|
|
564
654
|
* Series options that can be used to customize the appearance and behavior of a series.
|
|
565
655
|
*/
|
|
566
656
|
export declare type SeriesOptions<T extends SeriesType> = SeriesPartialOptionsMap[T];
|
|
567
657
|
|
|
568
|
-
declare type SeriesParameters<T extends SeriesType> = {
|
|
569
|
-
data: SeriesDataItemTypeMap[T][];
|
|
658
|
+
declare type SeriesParameters<T extends SeriesType, HorzScaleItem = Time> = {
|
|
659
|
+
data: SeriesDataItemTypeMap<HorzScaleItem>[T][];
|
|
570
660
|
reactive?: boolean;
|
|
571
661
|
options?: SeriesOptions<T>;
|
|
572
662
|
seriesOrder?: ReturnType<ISeriesApi<T>["seriesOrder"]>;
|
|
573
663
|
/**
|
|
574
664
|
* If true, the series will replace its data on every update.
|
|
575
|
-
* If false, it will try to
|
|
665
|
+
* If false, it will try to apply incremental updates to the existing series when possible,
|
|
666
|
+
* which can be useful for performance.
|
|
576
667
|
*
|
|
577
668
|
* @see {@link https://tradingview.github.io/lightweight-charts/docs#updating-the-data-in-a-series | TradingView documentation for updating series data}
|
|
578
669
|
*/
|
|
579
670
|
alwaysReplaceData?: boolean;
|
|
580
|
-
} & (T extends "Custom" ? CustomSeriesUniqueProps : {});
|
|
671
|
+
} & (T extends "Custom" ? CustomSeriesUniqueProps<HorzScaleItem> : {});
|
|
581
672
|
|
|
582
673
|
/**
|
|
583
674
|
* SeriesPrimitive component that can be used to create a primitive on series.
|
|
@@ -598,19 +689,19 @@ export declare const SeriesPrimitive: GenericSeriesPrimitiveComponent;
|
|
|
598
689
|
/**
|
|
599
690
|
* Series primitive API reference type that can be used to access the series primitive plugin API.
|
|
600
691
|
*/
|
|
601
|
-
export declare type SeriesPrimitiveApiRef = {
|
|
692
|
+
export declare type SeriesPrimitiveApiRef<HorzScaleItem = Time> = {
|
|
602
693
|
/**
|
|
603
694
|
* Internal reference to the series primitive API instance.
|
|
604
695
|
*/
|
|
605
|
-
_primitive: ISeriesPrimitive | null;
|
|
696
|
+
_primitive: ISeriesPrimitive<HorzScaleItem> | null;
|
|
606
697
|
/**
|
|
607
698
|
* Function to get the series primitive API instance.
|
|
608
699
|
*/
|
|
609
|
-
api(): ISeriesPrimitive | null;
|
|
700
|
+
api(): ISeriesPrimitive<HorzScaleItem> | null;
|
|
610
701
|
/**
|
|
611
702
|
* Function to initialize the series primitive API instance.
|
|
612
703
|
*/
|
|
613
|
-
init(): ISeriesPrimitive | null;
|
|
704
|
+
init(): ISeriesPrimitive<HorzScaleItem> | null;
|
|
614
705
|
/**
|
|
615
706
|
* Function to clear the series primitive API instance.
|
|
616
707
|
*/
|
|
@@ -620,32 +711,32 @@ export declare type SeriesPrimitiveApiRef = {
|
|
|
620
711
|
/**
|
|
621
712
|
* Series primitive properties that can be used to create a series primitive.
|
|
622
713
|
*/
|
|
623
|
-
export declare type SeriesPrimitiveProps<T extends SeriesType = SeriesType> = SeriesPrimitivePropsWithRender<T> | SeriesPrimitivePropsWithPlugin
|
|
714
|
+
export declare type SeriesPrimitiveProps<T extends SeriesType = SeriesType, HorzScaleItem = Time> = SeriesPrimitivePropsWithRender<T, HorzScaleItem> | SeriesPrimitivePropsWithPlugin<HorzScaleItem>;
|
|
624
715
|
|
|
625
|
-
declare type SeriesPrimitivePropsWithPlugin = {
|
|
626
|
-
plugin: ISeriesPrimitive
|
|
716
|
+
declare type SeriesPrimitivePropsWithPlugin<HorzScaleItem = Time> = {
|
|
717
|
+
plugin: ISeriesPrimitive<HorzScaleItem>;
|
|
627
718
|
render?: never;
|
|
628
719
|
};
|
|
629
720
|
|
|
630
|
-
declare type SeriesPrimitivePropsWithRender<T extends SeriesType> = {
|
|
631
|
-
render: RenderPrimitive<T>;
|
|
721
|
+
declare type SeriesPrimitivePropsWithRender<T extends SeriesType, HorzScaleItem = Time> = {
|
|
722
|
+
render: RenderPrimitive<T, HorzScaleItem>;
|
|
632
723
|
plugin?: never;
|
|
633
724
|
};
|
|
634
725
|
|
|
635
|
-
declare const SeriesPrimitiveRenderFunction: <T extends SeriesType>(props: SeriesPrimitiveProps<T>, ref: ForwardedRef<SeriesPrimitiveApiRef
|
|
726
|
+
declare const SeriesPrimitiveRenderFunction: <T extends SeriesType, HorzScaleItem = Time>(props: SeriesPrimitiveProps<T, HorzScaleItem>, ref: ForwardedRef<SeriesPrimitiveApiRef<HorzScaleItem>>) => JSX.Element | null;
|
|
636
727
|
|
|
637
728
|
/**
|
|
638
729
|
* Series component properties that can be used to create a series of a specific type.
|
|
639
730
|
*/
|
|
640
|
-
export declare type SeriesProps<T extends SeriesType> = Omit<SeriesTemplateProps<T>, "type">;
|
|
731
|
+
export declare type SeriesProps<T extends SeriesType, HorzScaleItem = Time> = Omit<SeriesTemplateProps<T, HorzScaleItem>, "type">;
|
|
641
732
|
|
|
642
733
|
/**
|
|
643
734
|
* Properties of a series template component that can be used to create a series of a specific type.
|
|
644
735
|
*/
|
|
645
|
-
declare type SeriesTemplateProps<T extends SeriesType> = {
|
|
736
|
+
declare type SeriesTemplateProps<T extends SeriesType, HorzScaleItem = Time> = {
|
|
646
737
|
type: T;
|
|
647
738
|
children?: ReactNode;
|
|
648
|
-
} & SeriesParameters<T>;
|
|
739
|
+
} & SeriesParameters<T, HorzScaleItem>;
|
|
649
740
|
|
|
650
741
|
/**
|
|
651
742
|
* Unique properties for the text watermark component.
|
|
@@ -662,27 +753,30 @@ export declare type TextWatermarkProps = DeepPartial<TextWatermarkOptions>;
|
|
|
662
753
|
* @see {@link https://tradingview.github.io/lightweight-charts/docs/time-scale | TradingView documentation for time scale}
|
|
663
754
|
* @example
|
|
664
755
|
* ```tsx
|
|
665
|
-
* <TimeScale
|
|
756
|
+
* <TimeScale
|
|
757
|
+
* visibleRange={{ from: 0, to: 100 }}
|
|
758
|
+
* onVisibleTimeRangeChange={() => {}}
|
|
759
|
+
* />
|
|
666
760
|
* ```
|
|
667
761
|
*/
|
|
668
|
-
export declare const TimeScale:
|
|
762
|
+
export declare const TimeScale: GenericTimeScaleComponent;
|
|
669
763
|
|
|
670
764
|
/**
|
|
671
765
|
* Time scale API reference type that can be used to access the time scale plugin API.
|
|
672
766
|
*/
|
|
673
|
-
export declare type TimeScaleApiRef = {
|
|
767
|
+
export declare type TimeScaleApiRef<HorzScaleItem = Time> = {
|
|
674
768
|
/**
|
|
675
769
|
* Reference to the time scale API.
|
|
676
770
|
*/
|
|
677
|
-
_timeScale: ITimeScaleApi<
|
|
771
|
+
_timeScale: ITimeScaleApi<HorzScaleItem> | null;
|
|
678
772
|
/**
|
|
679
773
|
* Function to get the time scale API.
|
|
680
774
|
*/
|
|
681
|
-
api: () => ITimeScaleApi<
|
|
775
|
+
api: () => ITimeScaleApi<HorzScaleItem> | null;
|
|
682
776
|
/**
|
|
683
777
|
* Function to initialize the time scale API.
|
|
684
778
|
*/
|
|
685
|
-
init: () => ITimeScaleApi<
|
|
779
|
+
init: () => ITimeScaleApi<HorzScaleItem> | null;
|
|
686
780
|
/**
|
|
687
781
|
* Function to clear the time scale API.
|
|
688
782
|
*/
|
|
@@ -720,11 +814,11 @@ declare type TimeScaleOptions = DeepPartial<TimeScaleOptions_2>;
|
|
|
720
814
|
* Use this component to configure how the chart's visible time/logical range is initialized
|
|
721
815
|
* and updated, and to react to time scale updates via event handlers.
|
|
722
816
|
*/
|
|
723
|
-
export declare type TimeScaleProps = {
|
|
817
|
+
export declare type TimeScaleProps<HorzScaleItem = Time> = {
|
|
724
818
|
/**
|
|
725
819
|
* Callback for when the visible time range changes.
|
|
726
820
|
*/
|
|
727
|
-
onVisibleTimeRangeChange?: TimeRangeChangeEventHandler<
|
|
821
|
+
onVisibleTimeRangeChange?: TimeRangeChangeEventHandler<HorzScaleItem>;
|
|
728
822
|
/**
|
|
729
823
|
* Callback for when the visible logical range changes.
|
|
730
824
|
*/
|
|
@@ -736,7 +830,7 @@ export declare type TimeScaleProps = {
|
|
|
736
830
|
/**
|
|
737
831
|
* The visible time range for the time scale.
|
|
738
832
|
*/
|
|
739
|
-
visibleRange?: IRange<
|
|
833
|
+
visibleRange?: IRange<HorzScaleItem>;
|
|
740
834
|
/**
|
|
741
835
|
* The visible logical range for the time scale.
|
|
742
836
|
*/
|
|
@@ -754,7 +848,17 @@ export declare type TimeScaleProps = {
|
|
|
754
848
|
/**
|
|
755
849
|
* Watermark API reference type that can be used to access the watermark plugin API.
|
|
756
850
|
*/
|
|
757
|
-
export declare type WatermarkApiRef<T extends WatermarkType> = T extends "text" ?
|
|
851
|
+
export declare type WatermarkApiRef<T extends WatermarkType, HorzScaleItem = Time> = T extends "text" ? {
|
|
852
|
+
_watermark: ITextWatermarkPluginApi<HorzScaleItem> | null;
|
|
853
|
+
api: () => ITextWatermarkPluginApi<HorzScaleItem> | null;
|
|
854
|
+
init: () => ITextWatermarkPluginApi<HorzScaleItem> | null;
|
|
855
|
+
clear: () => void;
|
|
856
|
+
} : {
|
|
857
|
+
_watermark: IImageWatermarkPluginApi<HorzScaleItem> | null;
|
|
858
|
+
api: () => IImageWatermarkPluginApi<HorzScaleItem> | null;
|
|
859
|
+
init: () => IImageWatermarkPluginApi<HorzScaleItem> | null;
|
|
860
|
+
clear: () => void;
|
|
861
|
+
};
|
|
758
862
|
|
|
759
863
|
/**
|
|
760
864
|
* Watermark component that can be used to add an image watermark to a chart pane.
|
|
@@ -775,13 +879,6 @@ export declare type WatermarkApiRef<T extends WatermarkType> = T extends "text"
|
|
|
775
879
|
*/
|
|
776
880
|
export declare const WatermarkImage: ForwardRefExoticComponent<ImageWatermarkProps & RefAttributes<WatermarkApiRef<"image">>>;
|
|
777
881
|
|
|
778
|
-
declare type WatermarkImageApiRefBase = {
|
|
779
|
-
_watermark: IImageWatermarkPluginApi<Time> | null;
|
|
780
|
-
api: () => IImageWatermarkPluginApi<Time> | null;
|
|
781
|
-
init: () => IImageWatermarkPluginApi<Time> | null;
|
|
782
|
-
clear: () => void;
|
|
783
|
-
};
|
|
784
|
-
|
|
785
882
|
/**
|
|
786
883
|
* Watermark component that can be used to add a text or image watermark to a chart pane.
|
|
787
884
|
*
|
|
@@ -803,13 +900,6 @@ declare type WatermarkImageApiRefBase = {
|
|
|
803
900
|
*/
|
|
804
901
|
export declare const WatermarkText: ForwardRefExoticComponent<TextWatermarkProps & RefAttributes<WatermarkApiRef<"text">>>;
|
|
805
902
|
|
|
806
|
-
declare type WatermarkTextApiRefBase = {
|
|
807
|
-
_watermark: ITextWatermarkPluginApi<Time> | null;
|
|
808
|
-
api: () => ITextWatermarkPluginApi<Time> | null;
|
|
809
|
-
init: () => ITextWatermarkPluginApi<Time> | null;
|
|
810
|
-
clear: () => void;
|
|
811
|
-
};
|
|
812
|
-
|
|
813
903
|
/**
|
|
814
904
|
* Watermark types supported by the library.
|
|
815
905
|
* - `text`: A text watermark.
|
|
@@ -817,4 +907,26 @@ declare type WatermarkTextApiRefBase = {
|
|
|
817
907
|
*/
|
|
818
908
|
export declare type WatermarkType = "text" | "image";
|
|
819
909
|
|
|
910
|
+
/**
|
|
911
|
+
* YieldCurveChart component that can be used to create a yield curve chart.
|
|
912
|
+
*
|
|
913
|
+
* @param props - The properties for the yield curve chart.
|
|
914
|
+
* @param ref - The ref to access the chart container.
|
|
915
|
+
* @returns A React component that renders the yield curve chart.
|
|
916
|
+
* @see {@link https://ukorvl.github.io/lightweight-charts-react-components/docs/chart | Chart documentation}
|
|
917
|
+
* @see {@link https://tradingview.github.io/lightweight-charts/docs/chart-types#yield-curve-chart | TradingView documentation for yield curve charts}
|
|
918
|
+
* @example
|
|
919
|
+
* ```tsx
|
|
920
|
+
* <YieldCurveChart>
|
|
921
|
+
* <LineSeries data={[{ time: 1, value: 5.2 }, { time: 12, value: 4.7 }]} />
|
|
922
|
+
* </YieldCurveChart>
|
|
923
|
+
* ```
|
|
924
|
+
*/
|
|
925
|
+
export declare const YieldCurveChart: ForwardRefExoticComponent<YieldCurveChartProps & RefAttributes<HTMLDivElement>>;
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* YieldCurveChart component props.
|
|
929
|
+
*/
|
|
930
|
+
export declare type YieldCurveChartProps = GenericChartProps<number, IYieldCurveChartApi, YieldCurveChartOptions>;
|
|
931
|
+
|
|
820
932
|
export { }
|