Closed mitulkoradiya closed 2 years ago
@mitulkoradiya thanks for the contribution!
But I don't really understand the use-case. What do you mean by "next ajax request", can you provide the code example of how you would use such a method?
The graph data is updated on filter change
...
$options = [
'chart_title' => 'Company',
'chart_type' => 'line',
'report_type' => 'group_by_date',
'model' => Item::class,
'group_by_field' => 'created_at',
'group_by_period' => $filter,
'filter_days' => 50,
'chart_color' => '160,208,245'
];
$companyChart = new LaravelChart($options); return response()->json($companyChart->getDatasets()); ...
2. Front-end javascript code
{!! $companyChart->renderChartJsLibrary() !!} {!! $companyChart->renderJs() !!}
@mitulkoradiya I've never seen anyone using this package like this, but ok, fair enough, it doesn't break anything, so I will merge the change.
Add function to return datasets for the next ajax request to update data in the graph.