1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-22 06:24:33 +01:00

Add votes number in results image.

This commit is contained in:
Madeorsk 2019-02-24 14:02:09 +01:00
parent c41d9fdd07
commit 3b24ecbb01

View File

@ -29,6 +29,13 @@ function percentage_pos_y($r, $percentage)
<circle cx="0" cy="0" r="<?= CIRCLE_R ?>" fill="<?= $colors[$index%$colors_number] ?>"></circle> <circle cx="0" cy="0" r="<?= CIRCLE_R ?>" fill="<?= $colors[$index%$colors_number] ?>"></circle>
<?php elseif($options_percentages[$index] != 0): ?> <?php elseif($options_percentages[$index] != 0): ?>
<path d="M<?= percentage_pos_x(CIRCLE_R, $used_percentage) ?> <?= percentage_pos_y(CIRCLE_R, $used_percentage) ?> A<?= CIRCLE_R." ".CIRCLE_R ?> 0 <?= ($options_percentages[$index] > 0.5 ? 1 : 0) ?> 1 <?= percentage_pos_x(CIRCLE_R, $used_percentage + $options_percentages[$index]) ?> <?= percentage_pos_y(CIRCLE_R, $used_percentage + $options_percentages[$index]) ?> L0 0" fill="<?= $colors[$index%$colors_number] ?>"></path> <path d="M<?= percentage_pos_x(CIRCLE_R, $used_percentage) ?> <?= percentage_pos_y(CIRCLE_R, $used_percentage) ?> A<?= CIRCLE_R." ".CIRCLE_R ?> 0 <?= ($options_percentages[$index] > 0.5 ? 1 : 0) ?> 1 <?= percentage_pos_x(CIRCLE_R, $used_percentage + $options_percentages[$index]) ?> <?= percentage_pos_y(CIRCLE_R, $used_percentage + $options_percentages[$index]) ?> L0 0" fill="<?= $colors[$index%$colors_number] ?>"></path>
<?php
$x = percentage_pos_x(CIRCLE_R, $used_percentage + $options_percentages[$index]/2);
$x = $x - $x/4;
$y = percentage_pos_y(CIRCLE_R, $used_percentage + $options_percentages[$index]/2);
$y = $y - $y/4;
?>
<text x="<?= $x ?>" y="<?= $y + 1.5 ?>" fill="rgba(0, 0, 0, 0.4)" text-anchor="middle" font-size="4" font-weight="600"><?= $option->votes ?></text>
<?php endif; ?> <?php endif; ?>
<?php $used_percentage += $options_percentages[$index]; endforeach; ?> <?php $used_percentage += $options_percentages[$index]; endforeach; ?>
</svg> </svg>