dev
Jing Li 2022-11-09 14:03:07 +08:00
parent b3ef13654a
commit 40f84c2db7
1 changed files with 12 additions and 6 deletions

View File

@ -86,24 +86,30 @@ class ChartController extends Controller
foreach ($quarters as $key => $value) { foreach ($quarters as $key => $value) {
$riceShrimpIndustry = $riceShrimpIndustries[$key] ?? null; $riceShrimpIndustry = $riceShrimpIndustries[$key] ?? null;
$areas[] = $riceShrimpIndustry?->area; if ($riceShrimpIndustry) {
$productOutputs[] = $riceShrimpIndustry?->product_output; $areas[] = $riceShrimpIndustry->area;
$productValues[] = $riceShrimpIndustry?->product_value; $productOutputs[] = bcdiv($riceShrimpIndustry->product_output, 2000, 2);
$productValues[] = bcdiv($riceShrimpIndustry->product_value, 10000, 2);;
} else {
$areas[] = null;
$productOutputs[] = null;
$productValues[] = null;
}
} }
return [ return [
'x_axis' => array_values($quarters), 'x_axis' => array_values($quarters),
'series' => [ 'series' => [
[ [
'name' => '产值', 'name' => '产值(万元)',
'data' => $productValues, 'data' => $productValues,
], ],
[ [
'name' => '面积', 'name' => '面积(亩)',
'data' => $areas, 'data' => $areas,
], ],
[ [
'name' => '产量', 'name' => '产量(吨)',
'data' => $productOutputs, 'data' => $productOutputs,
], ],
], ],