In Chart_Rendered($chart) , How can I change font size of datalabels ?
I try :
$chartOptions[“plugins”][“datalabels”] = TRUE;
$chartOptions[“plugins”][“datalabels”][“font”][“size”]=20;
then I get this error : ’ src\DbChart.php(1002): Cannot use a scalar value as an array '.
You should try to merge the array. For example:$chartOptions = array_merge_recursive($chartOptions, [“plugins” => [“datalabels” => [ “font” => [ “size” => 20 ] ] ] ]);
Thanks a lot.
arbei wrote:
You should try to merge the array. For example:> $chartOptions = array_merge_recursive($chartOptions, [“plugins” => [“datalabels” => [ “font” => [ “size” => 20 ] ] ] ]);
when I’m using 2022 , this code is not more work.
Please update to the latest template (Tools → Update Template). Also change your codes to:$chartOptions->import([“plugins” => [“datalabels” => [ “font” => [ “size” => 20 ] ] ] ]);
Thanks