fix: prevent empty doughnut chart from rendering as black circle

When all task counts are zero, the Chart.js doughnut renders as a solid
black/dark circle. Added a check to show a gray placeholder segment
with "No tasks yet" label instead.
This commit is contained in:
kelly
2025-12-07 12:04:07 -07:00
parent 497523ee0c
commit a3dda1520e

View File

@@ -55,6 +55,22 @@ class OrchestratorOutcomesChart extends ChartWidget
->pending()
->count();
// If all values are zero, show a placeholder to prevent empty doughnut rendering
$total = $completed + $dismissed + $snoozed + $pending;
if ($total === 0) {
return [
'datasets' => [
[
'label' => 'No Data',
'data' => [1],
'backgroundColor' => ['rgba(209, 213, 219, 0.5)'], // gray placeholder
'borderWidth' => 0,
],
],
'labels' => ['No tasks yet'],
];
}
return [
'datasets' => [
[