-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/aritroCoder/Aptos-snap
- Loading branch information
Showing
2 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
// Chart.js | ||
import * as React from 'react'; | ||
import { LineChart } from '@mui/x-charts/LineChart'; | ||
Check failure on line 3 in packages/site/src/components/Chart.tsx GitHub Actions / Build, lint, and test / Lint
|
||
import Box from '@mui/material/Box'; | ||
Check failure on line 4 in packages/site/src/components/Chart.tsx GitHub Actions / Build, lint, and test / Lint
|
||
|
||
export const Chart = ({ data }) => { | ||
|
||
Check failure on line 7 in packages/site/src/components/Chart.tsx GitHub Actions / Build, lint, and test / Lint
|
||
const xAxisData = Array.from({ length: 16 }, (_, index) => index + 1); | ||
const xAxisData = Object.keys(data).map((key) => parseInt(key.replace('price_', ''))); | ||
|
||
const yAxisData = data.map((entry) => entry.usdValue); | ||
|
||
return ( | ||
<LineChart | ||
xAxis={[{ data: xAxisData }]} | ||
series={[{ data: yAxisData }]} | ||
width={500} | ||
height={300} | ||
/> | ||
); | ||
const yAxisData = Object.values(data); | ||
|
||
return ( | ||
<Box sx={{ backgroundColor: 'white', p: 2, borderRadius: 8, borderColor: 'black', border: 2, marginTop: '2 rem' }}> | ||
Check failure on line 13 in packages/site/src/components/Chart.tsx GitHub Actions / Build, lint, and test / Lint
|
||
<p>USD Price Chart of last 16 minutes</p> | ||
<LineChart | ||
xAxis={[{ data: xAxisData }]} | ||
series={[{ data: yAxisData }]} | ||
width={500} | ||
height={300} | ||
/> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters