File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,10 @@ protected function getLabelsData(): array
206206 $ result = [];
207207
208208 $ labelColumn = explode ('. ' , $ this ->labelColumn )[1 ];
209- $ missingDataLabels = DB ::table ($ this ->table )->get ()->pluck ($ labelColumn )->toArray ();
209+
210+ $ missingDataLabels = empty ($ this ->missingDataLabels )
211+ ? DB ::table ($ this ->table )->get ()->pluck ($ labelColumn )->toArray ()
212+ : $ this ->missingDataLabels ;
210213
211214 foreach ($ missingDataLabels as $ label ) {
212215 $ result [$ label ] = $ this ->missingDataValue ;
Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ class LaravelMetrics
5353
5454 protected int $ missingDataValue = 0 ;
5555
56+ protected array $ missingDataLabels = [];
57+
5658 protected string $ groupBy ;
5759
5860 public function __construct (protected Builder |QueryBuilder $ builder )
@@ -441,10 +443,11 @@ public function labelColumn(string $column): self
441443 return $ this ;
442444 }
443445
444- public function fillMissingData (int $ missingDataValue = 0 ): self
446+ public function fillMissingData (int $ missingDataValue = 0 , array $ missingDataLabels = [] ): self
445447 {
446448 $ this ->fillMissingData = true ;
447449 $ this ->missingDataValue = $ missingDataValue ;
450+ $ this ->missingDataLabels = $ missingDataLabels ;
448451
449452 return $ this ;
450453 }
You can’t perform that action at this time.
0 commit comments