$data) { $month[] = $key; $openMonth[] = $data['open']; $clickMonth[] = $data['click']; } $day = []; $openDay = []; $clickDay = []; foreach ($dataDay as $key => $data) { $day[] = $key; $openDay[] = $data['open']; $clickDay[] = $data['click']; } $hour = []; $openHour = []; $clickHour = []; foreach ($dataHour as $key => $data) { $hour[] = $key; $openHour[] = $data['open']; $clickHour[] = $data['click']; } $randNumber = acym_rand(1000, 9000); $idCanvas = 'acy_canvas_rand_id'.$randNumber; $idLegend = 'acy_legend_rand_id'.$randNumber; $nbDataDay = count($dataDay); $nbDataHour = count($dataHour); $selectedChartHour = ""; $selectedChartDay = ""; $selectedChartMonth = ""; if ($nbDataHour < 49) { $selectedChartHour = "selected__choose_by"; $displayed = $hour; $clickDisplayed = $clickHour; $openDisplayed = $openHour; } elseif ($nbDataDay < 63) { $selectedChartDay = "selected__choose_by"; $displayed = $day; $clickDisplayed = $clickDay; $openDisplayed = $openDay; } else { $selectedChartMonth = "selected__choose_by"; $displayed = $month; $clickDisplayed = $clickMonth; $openDisplayed = $openMonth; } ?>

false, 'needTagScript' => true]); $loaded = true; } } function acym_displayRoundChart($percentage, string $type = '', string $class = '', string $topLabel = '', string $centerText = ''): void { if (empty($percentage) && $percentage !== 0) { return; } acym_initializeChart(); // A total-based value can exceed 100% (e.g. anonymized opens/clicks): clamp the ring so it never overflows $gauge = max(0, min(100, (float)$percentage)); if ($centerText === '') { $centerText = $percentage.'%'; } $randNumber = acym_rand(1000, 9000); $id = 'acy_round_chart_rand_id'.$randNumber; $idCanvas = 'acy_canvas_rand_id'.$randNumber; $green = '#3dea91'; $red = '#ff5259'; $orange = '#ffab15'; $defaultColor = '#00a4ff'; $isFixColor = false; $isInverted = false; switch ($type) { case 'click': $valueHigh = 5; $valueLow = 1; break; case 'open': $valueHigh = 30; $valueLow = 18; break; case 'delivery': $valueHigh = 90; $valueLow = 70; break; case 'fail': $valueHigh = 30; $valueLow = 10; $isInverted = true; break; case 'unsubscribe': $valueHigh = 10; $valueLow = 1; $isInverted = true; break; default: $isFixColor = true; } $color = $defaultColor; if (!$isFixColor) { if ($percentage >= $valueHigh) { $color = $isInverted ? $red : $green; } elseif ($percentage >= $valueLow) { $color = $orange; } else { $color = $isInverted ? $green : $red; } } ?>

['class' => true], 'label' => []]); ?>

$item) { if ($position > 9 && $cap) { $othersValue += (float)$item['value']; unset($data[$itemId]); $nbOthers++; continue; } $data[$itemId] = (float)$item['value']; $allLabelsArray[] = $item['label']; $colors[] = $item['color']; $position++; } if ($othersValue > 0) { $othersValue = $othersValue / $nbOthers; } } else { foreach ($data as $label => $number) { if ($position > 9 && $cap) { $othersValue += (float)$number; unset($data[$label]); continue; } $data[$label] = (float)$number; $allLabelsArray[] = acym_translation($label); $colors[] = acym_getChartColor($position); $position++; } } // We capped the number of elements shown, add the remaining values as "Others" at the end if ($othersValue > 0) { $data['ACYM_OTHER'] = $othersValue; $allLabelsArray[] = acym_translation('ACYM_OTHER'); $colors[] = acym_getChartColor($position); } ?>

['class' => true], 'label' => []]); ?>

$item) { if ($position > 9) { $cappedValue += (float)$item['value']; unset($data[$itemId]); $nbOther++; continue; } $data[$itemId] = (float)$item['value']; $allLabelsArray[] = $item['label']; $colors[] = $item['color']; $position++; } if ($cappedValue > 0) { $cappedValue = $cappedValue / $nbOther; $data[acym_translation('ACYM_OTHER')] = $cappedValue; $allLabelsArray[] = acym_translation('ACYM_OTHER'); $colors[] = acym_getChartColor($position); } ?>

['class' => true], 'label' => []]); ?>