dev
Jing Li 2022-11-16 16:19:18 +08:00
parent 5756e59ab7
commit a9a72b51a9
1 changed files with 10 additions and 6 deletions

View File

@ -87,9 +87,9 @@ class ChartController extends Controller
$riceShrimpIndustry = $riceShrimpIndustries[$key] ?? null; $riceShrimpIndustry = $riceShrimpIndustries[$key] ?? null;
if ($riceShrimpIndustry) { if ($riceShrimpIndustry) {
$areas[] = bcdiv($riceShrimpIndustry->area, 1000, 2); $areas[] = $riceShrimpIndustry->area;
$productOutputs[] = bcdiv($riceShrimpIndustry->product_output, 2000, 2); $productOutputs[] = $riceShrimpIndustry->product_output;
$productValues[] = bcdiv($riceShrimpIndustry->product_value, 10000, 2);; $productValues[] = $riceShrimpIndustry->product_value;
} else { } else {
$areas[] = null; $areas[] = null;
$productOutputs[] = null; $productOutputs[] = null;
@ -97,19 +97,21 @@ class ChartController extends Controller
} }
} }
$riceShrimpIndustry = $riceShrimpIndustries->first();
return [ return [
'x_axis' => array_values($quarters), 'x_axis' => array_values($quarters),
'series' => [ 'series' => [
[ [
'name' => '产值(万元)', 'name' => '产值' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->product_value_unit})" : ''),
'data' => $productValues, 'data' => $productValues,
], ],
[ [
'name' => '面积(千亩)', 'name' => '面积' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->area_unit})" : ''),,
'data' => $areas, 'data' => $areas,
], ],
[ [
'name' => '产量(吨)', 'name' => '产量' . ($riceShrimpIndustry ? "({$riceShrimpIndustry->product_output_unit})" : ''),,
'data' => $productOutputs, 'data' => $productOutputs,
], ],
], ],
@ -152,6 +154,7 @@ class ChartController extends Controller
}); });
return [ return [
'unit' => $riceShrimpFlows->first()?->unit,
'x_axis' => array_values($quarters), 'x_axis' => array_values($quarters),
'series' => $series->values()->all(), 'series' => $series->values()->all(),
]; ];
@ -199,6 +202,7 @@ class ChartController extends Controller
}); });
return [ return [
'unit' => $materiels->first()?->unit,
'x_axis' => array_values($quarters), 'x_axis' => array_values($quarters),
'series' => $series->values()->all(), 'series' => $series->values()->all(),
]; ];