Skip to content
Snippets Groups Projects
Commit 379282a7 authored by Antoine Gaudron-Desjardins's avatar Antoine Gaudron-Desjardins
Browse files

css

parent 2ded462a
No related branches found
No related tags found
1 merge request!38graph rework
Pipeline #44167 passed
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
ResponsiveContainer, ResponsiveContainer,
ComposedChart, ComposedChart,
} from "recharts"; } from "recharts";
import ToggleButton from "react-bootstrap/ToggleButton";
import "../styles/Graph.css"; import "../styles/Graph.css";
const CustomTooltip = ({ active, payload, label }) => { const CustomTooltip = ({ active, payload, label }) => {
...@@ -28,6 +28,7 @@ const CustomTooltip = ({ active, payload, label }) => { ...@@ -28,6 +28,7 @@ const CustomTooltip = ({ active, payload, label }) => {
function formatXAxis(value) { function formatXAxis(value) {
if (value == 0) return ""; if (value == 0) return "";
value = Math.round(value);
return Math.floor(value / 60).toString() + "h" + (value % 60).toString().padStart(2, "0"); return Math.floor(value / 60).toString() + "h" + (value % 60).toString().padStart(2, "0");
} }
...@@ -76,7 +77,7 @@ export default function Graph({ place }) { ...@@ -76,7 +77,7 @@ export default function Graph({ place }) {
dataKey="time" dataKey="time"
stroke="#FF0000" stroke="#FF0000"
strokeWidth={2} strokeWidth={2}
dot={{ stroke: "#FF0000", strokeWidth: 2, fill: "#fff" }} dot={false}
/> />
) : ( ) : (
<div /> <div />
...@@ -93,6 +94,9 @@ export default function Graph({ place }) { ...@@ -93,6 +94,9 @@ export default function Graph({ place }) {
axisLine={false} axisLine={false}
tickLine={false} tickLine={false}
tick={{ fill: "#FFFFFF", fontSize: "18" }} tick={{ fill: "#FFFFFF", fontSize: "18" }}
ticks={[...Array(4).keys()].map(
(i) => currentData[1] + (i * (currentData[2] - currentData[1])) / 3,
)}
dataKey="name" dataKey="name"
type="number" type="number"
interval="preserveStartEnd" interval="preserveStartEnd"
...@@ -120,7 +124,6 @@ export default function Graph({ place }) { ...@@ -120,7 +124,6 @@ export default function Graph({ place }) {
strokeWidth={2} strokeWidth={2}
fillOpacity={1} fillOpacity={1}
fill="url(#colorGradient)" fill="url(#colorGradient)"
dot={{ stroke: "#0967D2", strokeWidth: 2, fill: "#fff" }}
/> />
</ComposedChart> </ComposedChart>
</ResponsiveContainer> </ResponsiveContainer>
...@@ -128,20 +131,9 @@ export default function Graph({ place }) { ...@@ -128,20 +131,9 @@ export default function Graph({ place }) {
<div className="graph-title"> <div className="graph-title">
Temps d&apos;attente estimé depuis l&apos;ouverture (en minutes) Temps d&apos;attente estimé depuis l&apos;ouverture (en minutes)
</div> </div>
<div className="graph-button"> <button id="graph-avg-graph" onClick={() => setChecked(!checked)}>
<ToggleButton {checked ? "Retirer le temps d'attente moyen" : "Afficher le temps d'attente moyen"}
id="toggle-check" </button>
type="checkbox"
variant="primary"
checked={checked}
value="0"
onChange={() => setChecked(!checked)}
>
{checked
? "Retirer le temps d'attente moyen pour ce créneau"
: "Afficher le temps d'attente moyen pour ce créneau"}
</ToggleButton>
</div>
</div> </div>
)} )}
</> </>
......
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
display: inline-block; display: inline-block;
} }
.graph-button{ #graph-avg-graph {
margin-top: 10px; border: none;
background: none;
color: inherit;
font-style: italic;
font-size: 0.8rem;
font-weight: lighter;
margin-top: -1.5rem;
}
#graph-avg-graph:hover {
text-decoration-line: underline;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment