Closed ChristianAdrian closed 2 years ago
I am having the same issue, how you fixed this??
Make sure you are passing the model as an argument to the view helper in render() function, do not declare it as a public property.
return view('livewire.your-view', [
'lineChartModel' => $lineChartModel
]);
`public $date_debut= '2022-03-05'; public $date_fin = '2022-03-11'; public $search;
public $firstRun = true;
// public function mount()
// {
// $this->date_debut = '2022-03-05';
// $this->date_fin = now() ;
// }
public function render()
{
$date_debut = Carbon::parse($this->date_debut)->format('Y-m-d');
$date_fin = Carbon::parse($this->date_fin)->format('Y-m-d');
// $total = $programme->count();
// $archiver = $programme->where('programme_archiver', 'Archiver')->count();
$programme = Programme::whereBetween('created_at', [$date_debut, $date_fin])->get();
$pieChartModel = $programme->groupBy('programme_archiver')
->reduce(
function (PieChartModel $pieChartModel, $data) {
$archiverPie = $data->first()->programme_archiver;
$value = $data->count();
return $pieChartModel->addSlice($archiverPie, $value, ['#f6ad55','#fc8181']);
},
(new PieChartModel() )
->setTitle('Expenses by Statut')
->setAnimated($this->firstRun)
// ->withOnSliceClickEvent('onSliceClick')
);
// dd($pieChartModel);
return view('livewire.reporting.r-programme', [
'pieChartModel' => $pieChartModel,
'total' => $total,
'archiver' => $archiver,
'non_archiver' => $total - $archiver,
]);`
this my code i have same problem Can you help me ?
`$expenses = Admin::whereIn('team_id', ['5','6'])->get();
`![image](https://user-images.githubusercontent.com/61727441/113976449-3b9fca00-9852-11eb-9d0d-19e840c9f65d.png)
been trying to integrate charts in my project and used the sample but i keep gettin gthis error I check the value of columnChartModel and it has value