src/Classes/BaseChart.php
public function dataset(string $name, string $type, $data)
    {
        if ($data instanceof Collection) {
            $data = $data->toArray();
        }

        $dataset = new $this->dataset($name, $type, $data);

        array_push($this->datasets, $dataset);

        return $dataset;
    }
public function dataset(string $name, string $type, $data)
    {
        if ($data instanceof Collection) {
            $data = $data->toArray();
        }

        $dataset = new $this->dataset($name, $type, $data);

        array_push($this->datasets, $dataset);

        return $dataset;
    }
public function dataset ( string $ name , string $ type , $ data ) { if ( $ data instanceof Collection ) { $ data = $ data -> toArray ( ) ; } $ dataset = new $ this -> dataset ( $ name , $ type , $ data ) ; array_push ( $ this -> datasets , $ dataset ) ; return $ dataset ; }
Adds a new dataset to the chart.

@param string           $name
@param array|Collection $data
Adds a new dataset to the chart .