1👍
I had the same problem – I could not pass some configurations using the "options"-method.
I solved it adding my own method to the UserChart class
namespace App\Charts;
use ConsoleTVs\Charts\Classes\ChartJs\Chart;
class UserChart extends Chart
{
/**
* Initializes the chart.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function legendPosition(string $position)
{
return $this->options([
'legend' => [
'position' => $position,
],
]);
}
}
- [Chartjs]-Chart.js: Reverse bar chart with regular bars (Bottom to top instead of top to bottom)
- [Chartjs]-How to make chartjs chart with time y-axis?
0👍
It only works in this order: $chart->options(…)->dataset()
dataset returns the data set which has different options and is on dataset level. ->labels() returns a BaseChart and there the option value works on chart level. If the chain is ->dataset()->options() it doesn’t work since the dataset doesn’t have a configurable legend.
- [Chartjs]-Chartjs background color multiple Dataset
- [Chartjs]-Chart.js turn off all y axis and toggle them on / off
Source:stackexchange.com