Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Visualisation Quality Water
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Besson Lucas
Data Visualisation Quality Water
Commits
9a09c1bd
Commit
9a09c1bd
authored
2 months ago
by
Gilares Paul
Browse files
Options
Downloads
Patches
Plain Diff
Edit MetricsComponent.jsx
parent
f9a800cf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/components/MetricsComponent.jsx
+1
-149
1 addition, 149 deletions
frontend/src/components/MetricsComponent.jsx
with
1 addition
and
149 deletions
frontend/src/components/MetricsComponent.jsx
+
1
−
149
View file @
9a09c1bd
...
...
@@ -146,151 +146,3 @@ MetricBlock.propTypes = {
};
export
{
MetricsComponent
,
MetricBlock
};
\ No newline at end of file
/*
import PropTypes from "prop-types";
import MetricsGraph from "./MetricsGraph";
import MetricMoyenne from "./MetricMoy";
// Composant représentant un bloc de métrique
const MetricBlock = ({ title, children }) => {
return (
<div style={{
backgroundColor: "white",
padding: "20px",
margin: "10px",
borderRadius: "8px",
boxShadow: "0 2px 5px rgba(0,0,0,0.1)"
}}>
<h3 style={{ marginBottom: "10px", textAlign: "center" }}>{title}</h3>
{children}
</div>
);
};
// Composant contenant plusieurs métriques
const MetricsComponent = ({
typeIndic = "indicateurs",
selectedYear = "2024",
top5Dept = [],
flop5Dept = [],
selectedDept,
top5Communes = [],
flop5Communes = []
}) => {
console.log("flop5Dept", flop5Dept);
const isDeptSelected = !!selectedDept; // Vérifie si un département est sélectionné
return (
<div style={{
backgroundColor: "#f5f5f5",
borderRadius: "8px",
boxShadow: "0 2px 5px rgba(0,0,0,0.1)",
padding: "20px",
height: "100%",
maxHeight: "100vh",
overflowY: "auto",
display: "flex",
flexDirection: "column",
scrollbarWidth: "thin",
scrollbarColor: "#213547 #f9f9f9",
}}>
<h2 style={{ textAlign: "center" }}>📊 Statistiques</h2>
{//Moyenne nationale
}
<MetricMoyenne typeIndic={typeIndic} selectedYear={selectedYear} />
{// Graphique des moyennes
}
<MetricBlock title="Moyenne nationale du score selon les années">
<MetricsGraph typeIndic={typeIndic} selectedYear={selectedYear} selectedDept={selectedDept} />
</MetricBlock>
{// Si un département est sélectionné, afficher les communes, sinon afficher les départements
}
{isDeptSelected ? (
<>
<MetricBlock title={`Les 5 meilleures communes du département ${selectedDept} en ${selectedYear}`}>
<ol>
{top5Communes.map((commune) => (
<li key={commune.code}>
<span>{commune.name}</span> ({commune.code}) - Score: {commune.average}
</li>
))}
</ol>
</MetricBlock>
<MetricBlock title={`Les 5 pires communes du département ${selectedDept} en ${selectedYear}`}>
<ol>
{flop5Communes.map((commune) => (
<li key={commune.code}>
<span>{commune.name}</span> ({commune.code}) - Score: {commune.average}
</li>
))}
</ol>
</MetricBlock>
</>
) : (
<>
<MetricBlock title={`Les 5 meilleurs départements en ${selectedYear}`}>
<ol>
{top5Dept.map((dept) => (
<li key={dept.department}>
<span>{dept.departmentName}</span> ({dept.department})
</li>
))}
</ol>
</MetricBlock>
<MetricBlock title={`Les 5 pires départements en ${selectedYear}`}>
<ol>
{flop5Dept.slice().reverse().map((dept) => (
<li key={dept.department}>
<span>{dept.departmentName}</span> ({dept.department})
</li>
))}
</ol>
</MetricBlock>
</>
)}
</div>
);
};
// Définition des PropTypes
MetricsComponent.propTypes = {
typeIndic: PropTypes.string,
selectedYear: PropTypes.any,
top5Dept: PropTypes.arrayOf(PropTypes.shape({
department: PropTypes.any,
departmentName: PropTypes.any,
average: PropTypes.any
})),
flop5Dept: PropTypes.arrayOf(PropTypes.shape({
department: PropTypes.any,
departmentName: PropTypes.any,
average: PropTypes.any
})),
selectedDept: PropTypes.string,
top5Communes: PropTypes.arrayOf(PropTypes.shape({
code: PropTypes.any,
name: PropTypes.any,
average: PropTypes.any
})),
flop5Communes: PropTypes.arrayOf(PropTypes.shape({
code: PropTypes.any,
name: PropTypes.any,
average: PropTypes.any
})),
};
MetricBlock.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node
};
export default MetricsComponent;
*/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment