chg: [periodic_notification] Added css rule

pull/8575/head
Sami Mokaddem 2022-09-08 16:11:17 +02:00
parent d7b07138c1
commit 8d64a57095
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 33 additions and 27 deletions

View File

@ -48,7 +48,7 @@ $canvasWidth = 600;
$canvasHeight = 150;
foreach (array_keys($chartData) as $tag) {
$chartData[$tag][0] = [0, $canvasHeight - ($chartData[$tag][0] / $maxValue) * $canvasHeight];
$chartData[$tag][1] = [$canvasWidth/2, $canvasHeight - ($chartData[$tag][1] / $maxValue) * $canvasHeight];
$chartData[$tag][1] = [$canvasWidth / 2, $canvasHeight - ($chartData[$tag][1] / $maxValue) * $canvasHeight];
$chartData[$tag][2] = [$canvasWidth, $canvasHeight - ($chartData[$tag][2] / $maxValue) * $canvasHeight];
}
@ -113,12 +113,12 @@ if (!function_exists('computeLinePositions')) {
</tbody>
</table>
</div>
<?php if (!empty($allUniqueTags)): ?>
<?php if (!empty($allUniqueTags)) : ?>
<div style="padding: 0 40px; margin: -40px 20px 0 0;">
<div class="chart-container">
<div class="canvas">
<?php foreach ($chartData as $tag => $coords) : ?>
<?php for ($i=0; $i < 3; $i++) : ?>
<?php for ($i = 0; $i < 3; $i++) : ?>
<?php
$coord = $coords[$i];
$previousCoord = isset($coords[$i - 1]) ? $coords[$i - 1] : false;
@ -142,13 +142,13 @@ if (!function_exists('computeLinePositions')) {
<?php endforeach ?>
</div>
<div style="position: relative;">
<span style="<?= sprintf('position: absolute; white-space: nowrap; translate: -50%%; left: %spx; top: %spx;', 0, 0) ?>"><?= __('Period 2') ?></span>
<span style="<?= sprintf('position: absolute; white-space: nowrap; translate: -50%%; left: %spx; top: %spx;', $canvasWidth/2, 0) ?>"><?= __('Previous period') ?></span>
<span style="<?= sprintf('position: absolute; white-space: nowrap; translate: -50%%; left: %spx; top: %spx;', $canvasWidth, 0) ?>"><?= __('Current period') ?></span>
<span class="axis-label" style="<?= sprintf('left: %spx; top: %spx;', 0, 0) ?>"><?= __('Period 2') ?></span>
<span class="axis-label" style="<?= sprintf('left: %spx; top: %spx;', $canvasWidth / 2, 0) ?>"><?= __('Previous period') ?></span>
<span class="axis-label" style="<?= sprintf('left: %spx; top: %spx;', $canvasWidth, 0) ?>"><?= __('Current period') ?></span>
</div>
</div>
</div>
<?php else: ?>
<?php else : ?>
<p><?= __('- No tag for the selected tag namespace -') ?></p>
<?php endif; ?>
</div>
@ -297,4 +297,10 @@ if (!function_exists('computeLinePositions')) {
height: 10px;
border: 1px solid #000;
}
.axis-label {
position: absolute;
white-space: nowrap;
translate: -50%;
}
</style>