-
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.
feat(graphs): add graphs and make app responsive
- Loading branch information
Showing
27 changed files
with
689 additions
and
419 deletions.
There are no files selected for viewing
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
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
114 changes: 57 additions & 57 deletions
114
client/src/components/graphs/by-missing-productions.tsx
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 |
---|---|---|
@@ -1,65 +1,65 @@ | ||
import { Col } from "@dataesr/dsfr-plus"; | ||
import Highcharts from "highcharts"; | ||
import HighchartsReact from "highcharts-react-official"; | ||
import { ClipLoader } from "react-spinners"; | ||
// import { Col } from "@dataesr/dsfr-plus"; | ||
// import Highcharts from "highcharts"; | ||
// import HighchartsReact from "highcharts-react-official"; | ||
// import { ClipLoader } from "react-spinners"; | ||
|
||
const ContributionsGraphByStatus = ({ contributions, isLoading, isError }) => { | ||
if (isLoading) { | ||
return ( | ||
<Col className="comment"> | ||
<ClipLoader color="#123abc" size={50} /> | ||
</Col> | ||
); | ||
} | ||
// const ContributionsGraphByStatus = ({ contributions, isLoading, isError }) => { | ||
// if (isLoading) { | ||
// return ( | ||
// <Col className="comment"> | ||
// <ClipLoader color="#123abc" size={50} /> | ||
// </Col> | ||
// ); | ||
// } | ||
|
||
if (isError) { | ||
return <div>Une erreur s'est produite</div>; | ||
} | ||
// if (isError) { | ||
// return <div>Une erreur s'est produite</div>; | ||
// } | ||
|
||
if (!Array.isArray(contributions)) { | ||
return <div>Les données ne sont pas disponibles</div>; | ||
} | ||
// if (!Array.isArray(contributions)) { | ||
// return <div>Les données ne sont pas disponibles</div>; | ||
// } | ||
|
||
const newCount = contributions.filter( | ||
(contribution) => contribution.status === "new" | ||
).length; | ||
const ongoingCount = contributions.filter( | ||
(contribution) => contribution.status === "ongoing" | ||
).length; | ||
const treatedCount = contributions.filter( | ||
(contribution) => contribution.status === "treated" | ||
).length; | ||
// const newCount = contributions.filter( | ||
// (contribution) => contribution.status === "new" | ||
// ).length; | ||
// const ongoingCount = contributions.filter( | ||
// (contribution) => contribution.status === "ongoing" | ||
// ).length; | ||
// const treatedCount = contributions.filter( | ||
// (contribution) => contribution.status === "treated" | ||
// ).length; | ||
|
||
const chartData = [ | ||
{ name: "New", y: newCount }, | ||
{ name: "Ongoing", y: ongoingCount }, | ||
{ name: "Treated", y: treatedCount }, | ||
]; | ||
// const chartData = [ | ||
// { name: "New", y: newCount }, | ||
// { name: "Ongoing", y: ongoingCount }, | ||
// { name: "Treated", y: treatedCount }, | ||
// ]; | ||
|
||
const options = { | ||
chart: { | ||
type: "column", | ||
}, | ||
title: { | ||
text: "Nombre de demande d'affiliation par statut", | ||
}, | ||
xAxis: { | ||
type: "category", | ||
}, | ||
yAxis: { | ||
title: { | ||
text: "Nombre de contributions", | ||
}, | ||
}, | ||
series: [ | ||
{ | ||
name: "Statut", | ||
data: chartData, | ||
}, | ||
], | ||
}; | ||
// const options = { | ||
// chart: { | ||
// type: "pie", | ||
// }, | ||
// title: { | ||
// text: "Nombre de demande d'affiliation par statut", | ||
// }, | ||
// xAxis: { | ||
// type: "category", | ||
// }, | ||
// yAxis: { | ||
// title: { | ||
// text: "Nombre de contributions", | ||
// }, | ||
// }, | ||
// series: [ | ||
// { | ||
// name: "Statut", | ||
// data: chartData, | ||
// }, | ||
// ], | ||
// }; | ||
|
||
return <HighchartsReact highcharts={Highcharts} options={options} />; | ||
}; | ||
// return <HighchartsReact highcharts={Highcharts} options={options} />; | ||
// }; | ||
|
||
export default ContributionsGraphByStatus; | ||
// export default ContributionsGraphByStatus; |
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.