From de1ab8152d8d1ed9e9eb0982b5181eb43e53cf0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E8=BE=B0=E8=BD=A9?= Date: Fri, 19 Apr 2024 14:42:43 +0800 Subject: [PATCH] * Fix bug #48089. --- module/chart/model.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/module/chart/model.php b/module/chart/model.php index e46ae9ebfb..d8216ff312 100644 --- a/module/chart/model.php +++ b/module/chart/model.php @@ -345,9 +345,12 @@ class chartModel extends model /* 若查询结果大于50条,将50条之后的结果归于其他。*/ /* If the query results are greater than 50, the results after 50 will be classified as other. */ - $otherSum = array_sum(array_splice($stat, 50)); - $stat[$this->lang->chart->other] = $otherSum; - if(empty($date)) arsort($stat); + if(count($stat) > $maxCount) + { + $other = array_sum(array_slice($stat, $maxCount)); + $stat = array_slice($stat, 0, $maxCount); + $stat[$this->lang->chart->other] = $other; + } $seriesData = array(); $optionList = $this->getSysOptions($fields[$group]['type'], $fields[$group]['object'], $fields[$group]['field']);