Updation at Projects Completion Status when nothing is zero nothing is show.

This commit is contained in:
Kartik Sharma 2025-12-08 18:13:17 +05:30
parent e10bb10c20
commit 3a1aac8834
2 changed files with 17 additions and 9 deletions

View File

@ -42,7 +42,12 @@ const HorizontalBarChart = ({
categories.length === seriesData.length;
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
const combined = seriesData.map((value, index) => ({

View File

@ -12,14 +12,17 @@ const ProjectCompletionChart = () => {
isError,
error,
} = useProjectCompletionStatus();
const projectNames = projects?.map((p) => p.name) || [];
const projectProgress =
projects?.map((p) => {
const completed = p.completedWork || 0;
const planned = p.plannedWork || 1;
const percent = planned ? (completed / planned) * 100 : 0;
return Math.min(Math.round(percent), 100);
}) || [];
const filteredProjects = projects?.filter((p) => p.completedWork > 0) || [];
const projectNames = filteredProjects.map((p) => p.name);
const projectProgress = filteredProjects.map((p) => {
const completed = p.completedWork || 0;
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 (
<div className="card h-100">