Skip to content

Commit

Permalink
Merge pull request #11 from trash-and-fire/8-use-lightweight-charts400
Browse files Browse the repository at this point in the history
8 use lightweight charts400
  • Loading branch information
trash-and-fire committed Jun 7, 2023
2 parents 995e649 + 58d994a commit 492e04e
Show file tree
Hide file tree
Showing 20 changed files with 1,080 additions and 129 deletions.
230 changes: 152 additions & 78 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-scripts": "5.0.1",
"typescript": "~4.6.4",
"web-vitals": "^2.1.0",
"lightweight-charts": "^3.8.0",
"lightweight-charts": "4.0.1",
"classnames": "~2.3.1",
"react-router-dom": "~6.3.0",
"@types/webpack-env": "~1.17.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/demo/src/samples/legend.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useCallback, useRef, useState} from 'react';
import {BarPrice, ISeriesApi, LineWidth, MouseEventParams} from 'lightweight-charts';
import {ISeriesApi, LineWidth, MouseEventParams, LineData} from 'lightweight-charts';
import {Chart, AreaSeries} from 'lightweight-charts-react-wrapper';

import styles from './legend.module.css';
Expand All @@ -13,8 +13,8 @@ export default function Legend() {
return;
}
if (param.time) {
const price = param.seriesPrices.get(series.current) as BarPrice;
setLegend('ETC USD 7D VWAP' + ' ' + price.toFixed(2));
const {value} = param.seriesData.get(series.current) as LineData;
setLegend('ETC USD 7D VWAP' + ' ' + value.toFixed(2));
} else {
setLegend('ETC USD 7D VWAP');
}
Expand Down
8 changes: 4 additions & 4 deletions packages/demo/src/samples/moving-average.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useCallback, useRef, useState} from 'react';
import {BarPrice, BusinessDay, CandlestickData, CrosshairMode, ISeriesApi, MouseEventParams} from 'lightweight-charts';
import {AreaData, BusinessDay, CandlestickData, CrosshairMode, ISeriesApi, MouseEventParams} from 'lightweight-charts';
import {Chart, LineSeries, CandlestickSeries} from 'lightweight-charts-react-wrapper';

import styles from './moving-average.module.css';
Expand All @@ -12,9 +12,9 @@ export default function MovingAverage() {
if (ref.current === null) {
return;
}
const price = e.seriesPrices.get(ref.current) as BarPrice | undefined;
if (price !== undefined) {
setValue((Math.round(price * 100) / 100).toFixed(2));
const data = e.seriesData.get(ref.current) as AreaData | undefined;
if (data !== undefined) {
setValue((Math.round(data.value * 100) / 100).toFixed(2));
} else {
setValue('n/a');
}
Expand Down
Loading

0 comments on commit 492e04e

Please sign in to comment.