Can you rephrase it?
May 11, 2020
6
Level 5
Find date in range
I am preparing data to go into a graph rendered in JS. What I want to do is draw two data sets of an identical period (e.g. 7 days, 30 days) on one x-axis.
This is the approach I identified:
- Determine the length of the date range selected, e.g.
use Carbon\CarbonPeriod;
$range = CarbonPeriod::create(Carbon::today()->subWeek(), Carbon::today())->count();
- Load the array of events in that time range, imagine that would return:
use Carbon\Carbon;
$data = [Carbon::today()->subDays(2),Carbon::today()->subDays(5)];
- Determine what number day 1 and 2 are in $data within $range.
Tltr: I imagine I can then plot the numbers from 3 on the full x-axis range ($range). And by doing the same for dataset two, I will have identical measures to be able to plot both series on one x-axis. Happy to hear other approaches. What I basically want to do is (using Apexcharts) have this:

Please or to participate in this conversation.