From a9a72b51a9d282101b9561c17c8369cc35ce8a34 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Wed, 16 Nov 2022 16:19:18 +0800 Subject: [PATCH] Update --- app/Http/Controllers/ChartController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ChartController.php b/app/Http/Controllers/ChartController.php index cdd60d4..a60ead9 100644 --- a/app/Http/Controllers/ChartController.php +++ b/app/Http/Controllers/ChartController.php @@ -87,9 +87,9 @@ class ChartController extends Controller $riceShrimpIndustry = $riceShrimpIndustries[$key] ?? null; if ($riceShrimpIndustry) { - $areas[] = bcdiv($riceShrimpIndustry->area, 1000, 2); - $productOutputs[] = bcdiv($riceShrimpIndustry->product_output, 2000, 2); - $productValues[] = bcdiv($riceShrimpIndustry->product_value, 10000, 2);; + $areas[] = $riceShrimpIndustry->area; + $productOutputs[] = $riceShrimpIndustry->product_output; + $productValues[] = $riceShrimpIndustry->product_value; } else { $areas[] = null; $productOutputs[] = null; @@ -97,19 +97,21 @@ class ChartController extends Controller } } + $riceShrimpIndustry = $riceShrimpIndustries->first(); + return [ 'x_axis' => array_values($quarters), 'series' => [ [ - 'name' => '产值(万元)', + 'name' => '产值' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->product_value_unit})" : ''), 'data' => $productValues, ], [ - 'name' => '面积(千亩)', + 'name' => '面积' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->area_unit})" : ''),, 'data' => $areas, ], [ - 'name' => '产量(吨)', + 'name' => '产量' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->product_output_unit})" : ''),, 'data' => $productOutputs, ], ], @@ -152,6 +154,7 @@ class ChartController extends Controller }); return [ + 'unit' => $riceShrimpFlows->first()?->unit, 'x_axis' => array_values($quarters), 'series' => $series->values()->all(), ]; @@ -199,6 +202,7 @@ class ChartController extends Controller }); return [ + 'unit' => $materiels->first()?->unit, 'x_axis' => array_values($quarters), 'series' => $series->values()->all(), ];