container = 'charts::c3.container'; $this->script = 'charts::c3.script'; return $this; } /** * Formats the datasets. * * @return void */ public function formatDatasets() { $datasets = Collection::make($this->datasets); return json_encode([ 'columns' => Collection::make($this->datasets) ->each(function ($dataset) { $dataset->matchValues(count($this->labels)); }) ->map(function ($dataset) { return $dataset->format($this->labels); }) ->toArray(), 'type' => $datasets->first()->type, 'types' => $datasets->mapWithKeys(function ($d) { return [$d->name => $d->type]; })->toArray(), ]); } }