scope = $scope; } public function getScopeName ($scope) { return collect($this->options)->where('id', $scope)['name']; } public $options = [ ['id' => '1M', 'name' => '1 month'], ['id' => '2M', 'name' => '3 months'], ['id' => 'YTD', 'name' => 'Year to date'], ['id' => '1Y', 'name' => '1 year'], ['id' => '3Y', 'name' => '3 years'], ['id' => 'ALL', 'name' => 'All time'] ]; public ?Portfolio $portfolio; public array $myChart = [ 'type' => 'line', 'data' => [ 'labels' => ['Jan', 'Feb', 'Mar', 'Apr', 'May'], 'datasets' => [ [ 'label' => '# of Votes', 'data' => [2000, 2204, 3001, 2981, 2845], 'tension' => 0.4, 'pointStyle' => 'rect', 'pointRadius' => 4, 'pointHoverRadius' => 6 ], ] ], 'options' => [ 'scales' => [ // 'y' => [ // 'display' => false, // ], 'x' => [ // 'type' => 'time', 'time' => [ // Luxon format string // 'tooltipFormat' => 'DD' ], ], ], 'aspectRatio' => 0, 'plugins' => [ 'htmlLegend' => [ // ID of the container to put the legend in 'containerID' => 'chart-legend', ], 'legend' => [ 'display' => false, // 'position' => 'right' ] ] ] ]; }; ?>