/**
* 初始化圖表配置
*/
protected function setUpOptions()
{
$this->options([
"chart" => [
"type" => 'donut'
],
"series" => [],
'labels' => [
"show"=>true
],
"datalabels"=>[
"enabled"=>true,
'enabledOnSeries'=>'undefined',
],
'plotOptions' => [
'pie' => [
'donut' => [
'size' => '65%',
'labels' => [
"show" => true,
"name" => [
"show" => true
],
"value" => [
"show" => true
],
"total" => [
"show" => true,
"showAlways" => true,
"label" => '總收入',
"fontSize" => '22px',
"fontFamily" => 'Helvetica, Arial, sans-serif',
"fontWeight" => 600,
"formatter"=> function ($w) {
return round($w,2);
}
]
]
]
]
],
]);
}
我的目的是想獲取一個兩位數的總數,但是不曉得怎麼把下方 js 程式碼轉為 php
php
"formatter"=> function ($w) {
return round($w,2);
}
js
formatter: function (w) {
return w
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結