Skip to content

Commit

Permalink
feat: add line chart 2 stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
Menemi committed Dec 3, 2023
1 parent 779fe58 commit 06de3bd
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 236 deletions.
Binary file modified AspNetServer/Data/AppDb.db
Binary file not shown.
Binary file modified AspNetServer/bin/Debug/net6.0/Data/AppDb.db
Binary file not shown.
38 changes: 38 additions & 0 deletions react-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions react-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"babel-core": "^7.0.0-bridge.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"boxicons": "^2.1.4",
"chart.js": "^4.0.0",
"react": "^18.2.0",
"react-chartjs-2": "^5.0.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-router-dom": "^6.15.0",
Expand Down
57 changes: 57 additions & 0 deletions react-client/src/components/BarDiagram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from "react";
import {
CategoryScale,
Chart as ChartJS,
Legend,
LinearScale,
LineElement,
PointElement,
Title,
Tooltip,
} from "chart.js";
import {Line} from "react-chartjs-2";

ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
);

ChartJS.defaults.color = "white";

export default function BarDiagram(dataset, labels, titleDates) {
const options = {
responsive: true,
plugins: {
legend: {
position: "none",
},
title: {
display: true,
text: `Средние сахара за ${titleDates}`,
color: "white",
}
}
};

const data = {
labels,
datasets: [
{
data: dataset,
borderColor: "rgba(116, 33, 72, 1)",
backgroundColor: "rgba(116, 33, 72, 0.5)",
}
],
};

return (
<div className="single-diagram-wrapper">
<Line className="single-diagram" options={options} data={data}/>
</div>
)
}
25 changes: 24 additions & 1 deletion react-client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ main {
position: relative;
margin-top: 2ex;
left: 68px;
width: calc(100% - 56.8px);
width: calc(100% - 68px);
display: flex;
justify-content: space-evenly;
height: 100%;
}

.board-view-centered {
align-items: center;
flex-direction: column;
}

.input-stats-area {
Expand All @@ -119,6 +120,12 @@ main {
margin-top: 2ex;
}

.text-stats {
display: flex;
flex-direction: row;
gap: 3ex;
}

.input-single-date {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -322,6 +329,22 @@ ul {
list-style-type: none;
}

.single-diagram-wrapper {
padding: 2ex;
box-shadow: inset 0 0 0 3000px rgba(150, 150, 150, 0.292);
backdrop-filter: blur(10px);
border-radius: 2ex;
}

.single-diagram {
width: 450px;
height: 200px;
padding: 1ex;
background: rgba(255, 255, 255, 0.192);
backdrop-filter: blur(10px);
border-radius: 1ex;
}

@media screen and (max-width: 1180px) {
.board-view {
display: flex;
Expand Down
Loading

0 comments on commit 06de3bd

Please sign in to comment.