Open hasajacykacperek opened 4 months ago
I'm curious about this as well, I have daily data that isn't updated on the weekends so my charts looks similar to yours.
I realized that Trend::model returns a Laravel collection and can be filtered, so I used a filter like this:
$data = $data->filter(function ($item) {
return $item->aggregate > 0;
})->values();
Make sure you add values()
to the end of your filter so it re-indexes the array keys(I fought with that for a while).
You can use the ::query()
function to add SQL WHERE clause to filter out the weekends.
DAYOFWEEK(booked_date) <> 1 AND DAYOFWEEK(booked_date)<>7
Can the author add an exclude option to the between function so that I can enter which days of the week (weekends) are excluded from the data? The trend is a good form of data collection, but I don't know how I could exclude non-working days from my chart.