![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/vendor/corals/charts/src/Features/Chartjs/ |
<?php namespace ConsoleTVs\Charts\Features\Chartjs; trait Chart { /** * Minalist chart display (Hide labels and axes). * * @return self */ public function minimalist(bool $display) { $this->displayLegend(!$display); return $this->displayAxes(!$display); } /** * Display the chart legend. * * @param bool $legend * * @return self */ public function displayLegend(bool $legend) { return $this->options([ 'legend' => [ 'display' => $legend, ], ]); } /** * Display the chart axis. * * @param bool $axes * * @return self */ public function displayAxes(bool $axes, bool $strict = false) { if ($strict) { return $this->options([ 'scale' => [ 'display' => $axes, ], ]); } return $this->options([ 'scales' => [ 'xAxes' => [ [ 'display' => $axes, ], ], 'yAxes' => [ [ 'display' => $axes, ], ], ], ]); } /** * Set the bar width of the X Axis. * * @param float $width * * @return self */ public function barWidth(float $width) { return $this->options([ 'scales' => [ 'xAxes' => [ [ 'barPercentage' => $width, ], ], ], ]); } /** * Set the chart title. * * @param string $title * @param int $font_size * @param string $color * @param string $font_weight * @param string $font_family * * @return self */ public function title( string $title, int $font_size = 14, string $color = '#666', string $font_weight = 'bold', string $font_family = "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" ) { return $this->options([ 'title' => [ 'display' => true, 'fontFamily' => $font_family, 'fontSize' => $font_size, 'fontColor' => $color, 'fontStyle' => $font_weight, 'text' => $title, ], ]); } }