Updation at Projects Completion Status when nothing is zero nothing is show.
This commit is contained in:
parent
e10bb10c20
commit
3a1aac8834
@ -42,7 +42,12 @@ const HorizontalBarChart = ({
|
|||||||
categories.length === seriesData.length;
|
categories.length === seriesData.length;
|
||||||
|
|
||||||
if (!hasValidData) {
|
if (!hasValidData) {
|
||||||
return <div className="text-center text-gray-500">No data to display</div>;
|
return <div
|
||||||
|
className="d-flex justify-content-center align-items-center text-muted"
|
||||||
|
style={{ height: "300px" }}
|
||||||
|
>
|
||||||
|
No data found
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
// Combine seriesData and categories, then sort in descending order
|
// Combine seriesData and categories, then sort in descending order
|
||||||
const combined = seriesData.map((value, index) => ({
|
const combined = seriesData.map((value, index) => ({
|
||||||
|
|||||||
@ -12,14 +12,17 @@ const ProjectCompletionChart = () => {
|
|||||||
isError,
|
isError,
|
||||||
error,
|
error,
|
||||||
} = useProjectCompletionStatus();
|
} = useProjectCompletionStatus();
|
||||||
const projectNames = projects?.map((p) => p.name) || [];
|
const filteredProjects = projects?.filter((p) => p.completedWork > 0) || [];
|
||||||
const projectProgress =
|
|
||||||
projects?.map((p) => {
|
const projectNames = filteredProjects.map((p) => p.name);
|
||||||
const completed = p.completedWork || 0;
|
|
||||||
const planned = p.plannedWork || 1;
|
const projectProgress = filteredProjects.map((p) => {
|
||||||
const percent = planned ? (completed / planned) * 100 : 0;
|
const completed = p.completedWork || 0;
|
||||||
return Math.min(Math.round(percent), 100);
|
const planned = p.plannedWork || 1;
|
||||||
}) || [];
|
const percent = planned ? (completed / planned) * 100 : 0;
|
||||||
|
return Math.min(parseFloat(percent.toFixed(2)), 100); // limit to 2 decimals
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card h-100">
|
<div className="card h-100">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user