LaravelDaily / laravel-charts

Package to draw charts in Laravel with Chart.js
MIT License
522 stars 116 forks source link

Date range not working #72

Open jhourlad opened 2 years ago

jhourlad commented 2 years ago

Chart still renders date range starting at first unfiltered record even when specifying filter_period, range_date_start and range_date_end.

$params = [
  "chart_title" => "Transactions"
  "report_type" => "group_by_date"
  "model" => "App\Models\Transaction",
  "conditions" => array: [
    0 => array: [
      "name" => "Amount"
      "condition" => "user_business_id = 13"
      "color" => "#42C5D2"
      "fill" => true
    ]
  ],
  "group_by_field" => "created_at"
  "group_by_period" => "day"
  "chart_type" => "line"
  "aggregate_function" => "sum"
  "aggregate_field" => "amount"
  "continuous_time" => true
  "filter_field" => "created_at"
  "filter_period" => "week"
  "range_date_start" => "2021-10-25"
  "range_date_end" => "2021-10-31"
]

$data['chart'] = new LaravelChart($params);

image

ramon316 commented 10 months ago

i have the same problem, but i resolved with de format date, i use this format. 'filter_field' => 'created_at', 'range_date_start' => '2023-11-07 11:51:35', 'range_date_end' => '2023-11-30 11:51:35',