Chartjs-Is there a way to represent date hole in chartjs time series?

0👍

I ended up solving this problem directly with query. As I use TimescaleDB, I can use function: time_bucket_gapfill

So, here is my query:

$measures = \App\Models\Measure::where('meter_id', $meter->prm)
            ->whereBetween('time', [(clone($missingData->date_ini))->subDays(1), (clone($missingData->date_end))->addDays(1)])
            ->select([
                DB::raw("time_bucket_gapfill('30 minutes', time) AS pt30m"),
                DB::raw('sum(delta) as delta'),

            ])
            ->groupBy('pt30m')
            ->orderBy('pt30m')
            ->get()->map(function ($measure) {
                if ($measure->delta == null) $measure->delta = 0;
                return $measure;
            });

I’m still interested in learning how to do it from chartJS.

Leave a comment