-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #919 from parlemonde/ft-charts-data
Ft charts data
- Loading branch information
Showing
11 changed files
with
372 additions
and
25 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
11 changes: 10 additions & 1 deletion
11
src/components/admin/dashboard-statistics/ClassroomStats.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,7 +1,16 @@ | ||
import React from 'react'; | ||
|
||
import BarCharts from './charts/BarCharts'; | ||
|
||
const barChartData = [{ data: [4, 3, 5] }, { data: [1, 6, 3] }, { data: [2, 5, 6] }]; | ||
|
||
const ClassroomStats = () => { | ||
return <h1>Classe</h1>; | ||
return ( | ||
<> | ||
<h1>Classe</h1>; | ||
<BarCharts barChartData={barChartData} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ClassroomStats; |
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
56 changes: 56 additions & 0 deletions
56
src/components/admin/dashboard-statistics/charts/DashboardTable.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import Paper from '@mui/material/Paper'; | ||
import Table from '@mui/material/Table'; | ||
import TableBody from '@mui/material/TableBody'; | ||
import TableCell from '@mui/material/TableCell'; | ||
import TableContainer from '@mui/material/TableContainer'; | ||
import TableHead from '@mui/material/TableHead'; | ||
import TableRow from '@mui/material/TableRow'; | ||
import React from 'react'; | ||
|
||
// function createData(classroom: string, vm: sting, prof: string, status: string) { | ||
// return { classroom, vm, prof, status }; | ||
// } | ||
|
||
// const rows = [ | ||
// createData('Frozen yoghurt', 159, 6.0, 24, 4.0), | ||
// createData('Ice cream sandwich', 237, 9.0, 37, 4.3), | ||
// createData('Eclair', 262, 16.0, 24, 6.0), | ||
// createData('Cupcake', 305, 3.7, 67, 4.3), | ||
// createData('Gingerbread', 356, 16.0, 49, 3.9), | ||
// ]; | ||
|
||
export default function DashboardTable() { | ||
return ( | ||
<TableContainer component={Paper}> | ||
<Table sx={{ minWidth: 650 }} aria-label="simple table"> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>A surveiller</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell align="right">Classe</TableCell> | ||
<TableCell align="right">Village-Monde</TableCell> | ||
<TableCell align="right">Professeur</TableCell> | ||
<TableCell align="right">Statut</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{/* {rows.map((row) => ( | ||
<TableRow | ||
key={row.name} | ||
sx={{ '&:last-child td, &:last-child th': { border: 0 } }} | ||
> | ||
<TableCell component="th" scope="row"> | ||
{row.name} | ||
</TableCell> | ||
<TableCell align="right">{row.classroom}</TableCell> | ||
<TableCell align="right">{row.vm}</TableCell> | ||
<TableCell align="right">{row.prof}</TableCell> | ||
<TableCell align="right">{row.status}</TableCell> | ||
</TableRow> | ||
))} */} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
} |
49 changes: 49 additions & 0 deletions
49
src/components/admin/dashboard-statistics/charts/HorizontalChart.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { BarChart } from '@mui/x-charts/BarChart'; | ||
import * as React from 'react'; | ||
|
||
import styles from '../styles/charts.module.css'; | ||
import { useGetClassroomExchanges, ClassroomExchangesStats } from 'src/api/statistics/statistics.get.ts'; | ||
Check warning on line 5 in src/components/admin/dashboard-statistics/charts/HorizontalChart.tsx GitHub Actions / lint
|
||
|
||
const chartSetting = { | ||
xAxis: [ | ||
{ | ||
label: 'publications & commentaires', | ||
}, | ||
], | ||
width: 500, | ||
height: 400, | ||
}; | ||
const dataset = []; | ||
|
||
const valueFormatter = (value: number | null) => `${value}mm`; | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('Data:', data); | ||
|
||
// handle loading & errors | ||
// if (isLoading) return <div>Loading...</div>; | ||
// if (isError) return <div>Error...</div>; | ||
|
||
export default function HorizontalBars() { | ||
return ( | ||
<div className={styles.horizontalBars}> | ||
<BarChart | ||
dataset={dataset} | ||
yAxis={[ | ||
{ | ||
scaleType: 'band', | ||
dataKey: 'month', | ||
}, | ||
]} | ||
series={[{ dataKey: 'seoul', valueFormatter, color: '#4C3ED9' }]} | ||
layout="horizontal" | ||
{...chartSetting} | ||
slotProps={{ | ||
bar: { | ||
clipPath: `inset(0px round 25px)`, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
126 changes: 126 additions & 0 deletions
126
src/components/admin/dashboard-statistics/charts/HorizontalCharts.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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import * as React from "react"; | ||
import { BarChart } from "@mui/x-charts/BarChart"; | ||
|
||
import styles from '../styles/charts.module.css'; | ||
|
||
const chartSetting = { | ||
xAxis: [ | ||
{ | ||
label: "publications & commentaires", | ||
}, | ||
], | ||
width: 500, | ||
height: 400, | ||
}; | ||
const dataset = [ | ||
{ | ||
pays: 59, | ||
paris: 57, | ||
newYork: 86, | ||
seoul: 21, | ||
month: "pays 1", | ||
}, | ||
{ | ||
london: 50, | ||
paris: 52, | ||
newYork: 78, | ||
seoul: 28, | ||
month: "Fev", | ||
}, | ||
{ | ||
london: 47, | ||
paris: 53, | ||
newYork: 106, | ||
seoul: 41, | ||
month: "Mar", | ||
}, | ||
{ | ||
london: 54, | ||
paris: 56, | ||
newYork: 92, | ||
seoul: 73, | ||
month: "Apr", | ||
}, | ||
{ | ||
london: 57, | ||
paris: 69, | ||
newYork: 92, | ||
seoul: 99, | ||
month: "May", | ||
}, | ||
{ | ||
london: 60, | ||
paris: 63, | ||
newYork: 103, | ||
seoul: 144, | ||
month: "June", | ||
}, | ||
{ | ||
london: 59, | ||
paris: 60, | ||
newYork: 105, | ||
seoul: 319, | ||
month: "July", | ||
}, | ||
{ | ||
london: 65, | ||
paris: 60, | ||
newYork: 106, | ||
seoul: 249, | ||
month: "Aug", | ||
}, | ||
{ | ||
london: 51, | ||
paris: 51, | ||
newYork: 95, | ||
seoul: 131, | ||
month: "Sept", | ||
}, | ||
{ | ||
london: 60, | ||
paris: 65, | ||
newYork: 97, | ||
seoul: 55, | ||
month: "Oct", | ||
}, | ||
{ | ||
london: 67, | ||
paris: 64, | ||
newYork: 76, | ||
seoul: 48, | ||
month: "Nov", | ||
}, | ||
{ | ||
london: 61, | ||
paris: 70, | ||
newYork: 103, | ||
seoul: 25, | ||
month: "Dec", | ||
}, | ||
]; | ||
|
||
const valueFormatter = (value: number | null) => `${value}mm`; | ||
|
||
export default function HorizontalBars() { | ||
return ( | ||
<div className={styles.horizontalBars}> | ||
<BarChart | ||
dataset={dataset} | ||
yAxis={[ | ||
{ | ||
scaleType: "band", | ||
dataKey: "month", | ||
}, | ||
]} | ||
series={[{ dataKey: "seoul", valueFormatter, color: '#4C3ED9' }]} | ||
layout="horizontal" | ||
{...chartSetting} | ||
slotProps={{ | ||
bar: { | ||
clipPath: `inset(0px round 25px)`, | ||
}, | ||
}} | ||
/> | ||
</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.