N°541 - Dashlets: Improve readability when to much labels (pie chart) or too long labels (bar chart)

This commit is contained in:
acognet
2023-04-25 12:09:11 +02:00
parent fbd72b2783
commit 3c94974d9d

View File

@@ -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);