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:
@@ -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' => [
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user