UI: NodeList added Pie Chart and extracted Table Data

This commit is contained in:
Luis-Hebendanz
2023-08-12 00:01:09 +02:00
parent 3d3dcc800b
commit de9cac534b
8 changed files with 1608 additions and 276 deletions

View File

@@ -0,0 +1,45 @@
import React, { PureComponent } from 'react';
import { PieChart, Pie, Sector, Cell, ResponsiveContainer, Legend } from 'recharts';
import { useTheme } from '@mui/material/styles';
import { Box, Color } from '@mui/material';
export interface PieData {
name: string;
value: number;
color: string;
};
interface Props {
data: PieData[];
showLabels?: boolean;
};
export default function NodePieChart(props: Props ) {
const theme = useTheme();
const {data, showLabels} = props;
return (
<Box height={350}>
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie
data={data}
innerRadius={85}
outerRadius={120}
fill={theme.palette.primary.main}
dataKey="value"
nameKey="name"
label={showLabels}
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.color} />
))}
</Pie>
<Legend verticalAlign="bottom" />
</PieChart>
</ResponsiveContainer>
</Box>
);
};