Skip to content

Commit 492e04e

Browse files
Merge pull request #11 from trash-and-fire/8-use-lightweight-charts400
8 use lightweight charts400
2 parents 995e649 + 58d994a commit 492e04e

20 files changed

+1080
-129
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 152 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react-scripts": "5.0.1",
1717
"typescript": "~4.6.4",
1818
"web-vitals": "^2.1.0",
19-
"lightweight-charts": "^3.8.0",
19+
"lightweight-charts": "4.0.1",
2020
"classnames": "~2.3.1",
2121
"react-router-dom": "~6.3.0",
2222
"@types/webpack-env": "~1.17.0",

packages/demo/src/samples/legend.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useCallback, useRef, useState} from 'react';
2-
import {BarPrice, ISeriesApi, LineWidth, MouseEventParams} from 'lightweight-charts';
2+
import {ISeriesApi, LineWidth, MouseEventParams, LineData} from 'lightweight-charts';
33
import {Chart, AreaSeries} from 'lightweight-charts-react-wrapper';
44

55
import styles from './legend.module.css';
@@ -13,8 +13,8 @@ export default function Legend() {
1313
return;
1414
}
1515
if (param.time) {
16-
const price = param.seriesPrices.get(series.current) as BarPrice;
17-
setLegend('ETC USD 7D VWAP' + ' ' + price.toFixed(2));
16+
const {value} = param.seriesData.get(series.current) as LineData;
17+
setLegend('ETC USD 7D VWAP' + ' ' + value.toFixed(2));
1818
} else {
1919
setLegend('ETC USD 7D VWAP');
2020
}

packages/demo/src/samples/moving-average.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useCallback, useRef, useState} from 'react';
2-
import {BarPrice, BusinessDay, CandlestickData, CrosshairMode, ISeriesApi, MouseEventParams} from 'lightweight-charts';
2+
import {AreaData, BusinessDay, CandlestickData, CrosshairMode, ISeriesApi, MouseEventParams} from 'lightweight-charts';
33
import {Chart, LineSeries, CandlestickSeries} from 'lightweight-charts-react-wrapper';
44

55
import styles from './moving-average.module.css';
@@ -12,9 +12,9 @@ export default function MovingAverage() {
1212
if (ref.current === null) {
1313
return;
1414
}
15-
const price = e.seriesPrices.get(ref.current) as BarPrice | undefined;
16-
if (price !== undefined) {
17-
setValue((Math.round(price * 100) / 100).toFixed(2));
15+
const data = e.seriesData.get(ref.current) as AreaData | undefined;
16+
if (data !== undefined) {
17+
setValue((Math.round(data.value * 100) / 100).toFixed(2));
1818
} else {
1919
setValue('n/a');
2020
}

0 commit comments

Comments
 (0)