diff --git a/client/src/components/admin/donutChartContainer.js b/client/src/components/admin/donutChartContainer.js
index fc4f44be9..c2e781c82 100644
--- a/client/src/components/admin/donutChartContainer.js
+++ b/client/src/components/admin/donutChartContainer.js
@@ -1,7 +1,8 @@
-import React, { useEffect, useRef } from "react";
-import * as d3 from "d3";
+import React, { useEffect, useRef } from 'react';
+import * as d3 from 'd3';
+import { Box, Typography } from '@mui/material';
-import "../../sass/Dashboard.scss";
+import '../../sass/Dashboard.scss';
const DonutChartContainer = (props) => {
const ref = useRef(null);
@@ -25,75 +26,75 @@ const DonutChartContainer = (props) => {
total += newValue;
pieData.push({ value: newValue, color: color });
pieNames.push(
-
-
+
-
-
-
+ >
+
+
{key}: {newValue}
-
-
-
+
+
+
);
}
total = Math.round(100 * total) / 100;
-
useEffect(() => {
const createPie = d3
.pie(pieData)
.value((d) => d.value)
.sort(null);
-
+
const createArc = d3.arc().innerRadius(40).outerRadius(80);
-
+
const data = createPie(pieData);
const group = d3.select(ref.current);
- const groupWithData = group.selectAll("g.arc").data(data);
+ const groupWithData = group.selectAll('g.arc').data(data);
groupWithData.exit().remove();
const groupWithUpdate = groupWithData
.enter()
- .append("g")
- .attr("class", "arc");
+ .append('g')
+ .attr('class', 'arc');
const path = groupWithUpdate
- .append("path")
- .merge(groupWithData.select("path.arc"));
+ .append('path')
+ .merge(groupWithData.select('path.arc'));
path
- .attr("class", "arc")
- .attr("d", createArc)
- .attr("fill", (d, i) => {
+ .attr('class', 'arc')
+ .attr('d', createArc)
+ .attr('fill', (d, i) => {
const { data } = d;
return data.color;
});
}, [props, pieData]);
return (
-
-
-
-
+
+
+
+
+ {props.chartName}:
+
+
+ {total}
+
+
+
-
-
-
-
+
+
+ {pieNames}
+
+
+
);
};