From 3c94974d9dd70d5c6d22d05451a3b9b8ee8ed32f Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 25 Apr 2023 12:09:11 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B0541=20-=20Dashlets:=20Improve=20readabil?= =?UTF-8?q?ity=20when=20to=20much=20labels=20(pie=20chart)=20or=20too=20lo?= =?UTF-8?q?ng=20labels=20(bar=20chart)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/displayblock.class.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 1fff40f1f8..918060846f 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1009,7 +1009,6 @@ EOF $iTotalCount = 0; $aValues = array(); $aURLs = array(); - $iMaxNbCharsInLabel = 0; foreach ($aRes as $iRow => $aRow) { @@ -1019,9 +1018,6 @@ EOF $iTotalCount += $aRow['_itop_count_']; $aValues[] = array('label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'), 'label_html' => $sHtmlValue, 'value' => (int) $aRow[$sFctVar]); - if ($iMaxNbCharsInLabel < mb_strlen($sValue)) { - $iMaxNbCharsInLabel = mb_strlen($sValue); - } // Build the search for this subset $oSubsetSearch = $this->m_oFilter->DeepClone(); @@ -1036,9 +1032,13 @@ EOF { case 'bars': $aNames = array(); + $iMaxNbCharsInLabel = 0; foreach($aValues as $idx => $aValue) { $aNames[$idx] = $aValue['label']; + if ($iMaxNbCharsInLabel < mb_strlen($aValue['label'])) { + $iMaxNbCharsInLabel = mb_strlen($aValue['label']); + } } $sJSNames = json_encode($aNames);