Skip to content

Commit eec8a3f

Browse files
authored
Merge pull request #15 from Software-Engineering-DHBW/Stats
Stats
2 parents 872cfd2 + 5d67a29 commit eec8a3f

File tree

4 files changed

+150
-65
lines changed

4 files changed

+150
-65
lines changed

wall-tracker/package-lock.json

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

wall-tracker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@fontsource/roboto": "^4.5.3",
1212
"@material-ui/core": "^4.12.3",
1313
"@mui/icons-material": "^5.4.4",
14-
"@mui/material": "^5.4.4",
14+
"@mui/material": "^5.5.2",
1515
"@testing-library/jest-dom": "^5.16.2",
1616
"@testing-library/react": "^12.1.3",
1717
"@testing-library/user-event": "^13.5.0",

wall-tracker/src/Components/Charts.tsx

Lines changed: 93 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,105 @@
11
import React, { useEffect, useState} from 'react';
2-
import {Paper} from "@mui/material";
2+
import {Paper, Typography} from "@mui/material";
33
import useAxios from "../Hooks/useAxios.hook";
4-
import {CartesianGrid, Legend, Line, LineChart, Tooltip, XAxis, YAxis} from 'recharts';
4+
import {CartesianGrid, Legend, Line, BarChart,Bar, Tooltip, XAxis, YAxis, ResponsiveContainer} from 'recharts';
55

66
function Charts() {
7-
const [data, setData] = useState();
8-
let url = "boulder";
9-
const [ response, isLoading, isError ] = useAxios(url);
7+
// const [data1, setData] = useState();
8+
// let url = "progress";
9+
// const [ response, isLoading, isError ] = useAxios(url);
1010

11-
useEffect(() => {
12-
setData(response)
11+
// const [data2, setData] = useState();
12+
// let url = "boulder";
13+
// const [ response, isLoading, isError ] = useAxios(url);
14+
15+
// const [data3, setData] = useState();
16+
// let url = "ratings";
17+
// const [ response, isLoading, isError ] = useAxios(url);
18+
19+
// useEffect(() => {
20+
// setData(response)
21+
//
22+
// }, [url]);
23+
24+
const testdata = [
25+
{
26+
"Boulder": "01",
27+
"pv": 2
28+
},
29+
{
30+
"Boulder": "02",
31+
"pv": 8
32+
},
33+
{
34+
"Boulder": "03",
35+
"pv": 9
36+
},
37+
{
38+
"Boulder": "04",
39+
"pv": 3
40+
},
41+
{
42+
"Boulder": "05",
43+
"pv": 4
44+
},
45+
{
46+
"Boulder": "06",
47+
"pv": 8
48+
},
49+
{
50+
"Boulder": "07",
51+
"pv": 3
52+
}
53+
]
1354

14-
}, [url]);
1555

1656
return(
57+
1758
<Paper>
18-
<LineChart width={730} height={250} data={data}>
19-
<CartesianGrid strokeDasharray="3 3" />
20-
<XAxis dataKey="id" type="number"/>
21-
<YAxis />
22-
<Tooltip />
23-
<Legend />
24-
<Line type="monotone" dataKey="difficulty" stroke="#8884d8" />
25-
</LineChart>
59+
<Typography align="center">
60+
<h2>Completed Bolder</h2>
61+
62+
</Typography>
63+
<ResponsiveContainer width='100%' height={400}>
64+
<BarChart width={700} height={250} data={testdata} margin={{ top: 20, right: 50, left: 20, bottom: 20 }}>
65+
<CartesianGrid strokeDasharray="3 3" />
66+
<XAxis dataKey="Boulder" />
67+
<YAxis />
68+
<Tooltip />
69+
<Legend />
70+
<Bar dataKey="pv" fill="#8884d8" name="Completed"/>
71+
</BarChart>
72+
</ResponsiveContainer>
73+
74+
<Typography align="center">
75+
<h2>Difficulty of the Bolder</h2>
76+
77+
</Typography>
78+
<ResponsiveContainer width='100%' height={400}>
79+
<BarChart width={700} height={250} data={testdata} margin={{ top: 20, right: 50, left: 20, bottom: 20 }}>
80+
<CartesianGrid strokeDasharray="3 3" />
81+
<XAxis dataKey="Boulder" />
82+
<YAxis />
83+
<Tooltip />
84+
<Legend />
85+
<Bar dataKey="pv" fill="#8884d8" name="Difficulty"/>
86+
</BarChart>
87+
</ResponsiveContainer>
88+
89+
<Typography align="center">
90+
<h2>Rating of the Bolder</h2>
91+
92+
</Typography>
93+
<ResponsiveContainer width='100%' height={400}>
94+
<BarChart width={700} height={250} data={testdata} margin={{ top: 20, right: 50, left: 20, bottom: 20 }}>
95+
<CartesianGrid strokeDasharray="3 3" />
96+
<XAxis dataKey="Boulder" />
97+
<YAxis />
98+
<Tooltip />
99+
<Legend />
100+
<Bar dataKey="pv" fill="#8884d8" name="Rating of the Bolder" />
101+
</BarChart>
102+
</ResponsiveContainer>
26103
</Paper>
27104
)
28105
}

wall-tracker/src/Views/Stats.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import { Typography } from '@mui/material';
12
import React from 'react'
23
import Charts from "../Components/Charts";
4+
import Container from '@mui/material/Container';
5+
36

47
const Stats = () => {
58
return(
69
<div>
7-
Stats Page
10+
11+
<Typography align="center">
12+
<h1>Your Personal Stats</h1>
13+
14+
</Typography>
815
<Charts />
16+
917
</div>
1018
)
1119
}

0 commit comments

Comments
 (0)