p8/8 done lab7 done
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { BarChart } from '@mui/x-charts/BarChart';
|
||||
import { LineChart } from '@mui/x-charts/LineChart';
|
||||
import Container from '@mui/material/Container';
|
||||
import type { tGroup } from "../groupdata";
|
||||
import { useState } from 'react';
|
||||
@@ -10,6 +11,7 @@ type GroupProps = {
|
||||
|
||||
|
||||
function GroupChart({ data }: GroupProps) {
|
||||
const [isBar, setIsBar] = useState(true);
|
||||
const [series, setSeries] = useState({
|
||||
'Максимальная высота': true,
|
||||
'Средняя высота': false,
|
||||
@@ -30,7 +32,7 @@ function GroupChart({ data }: GroupProps) {
|
||||
|
||||
return (
|
||||
<Container maxWidth="lg">
|
||||
<BarChart
|
||||
{isBar && <BarChart
|
||||
dataset={data}
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'Группа' }]}
|
||||
series={seriesY}
|
||||
@@ -40,8 +42,19 @@ function GroupChart({ data }: GroupProps) {
|
||||
}
|
||||
}}
|
||||
{...chartSetting}
|
||||
/>
|
||||
<SettingChart series={series} setSeries={setSeries} />
|
||||
/>}
|
||||
{!isBar &&<LineChart
|
||||
dataset={data}
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'Группа' }]}
|
||||
series={seriesY}
|
||||
slotProps={{
|
||||
legend: {
|
||||
position: { vertical: 'bottom', horizontal: 'center' },
|
||||
},
|
||||
}}
|
||||
{...chartSetting}
|
||||
/>}
|
||||
<SettingChart series={series} setSeries={setSeries} isBar={isBar} setIsBar={setIsBar} />
|
||||
</Container>
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user