-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
407 additions
and
236 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -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> | ||
) | ||
} |
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
Oops, something went wrong.