@if($leadingCandidate)
{{ $leadingCandidate->votes_count }} Suara ({{ $leadingCandidate->percentage }}%)
@else
Menunggu suara masuk
@endif
@if($event->max_choices > 1)
Event ini mengizinkan setiap pemilih untuk memilih hingga {{ $event->max_choices }} kandidat.
Total pilihan suara terkumpul saat ini adalah {{ $totalVotes }} suara.
@endif
Visualisasi Data Suara
@if(count($timelineData['labels']) > 0)
@else
Belum Ada Data Tren
Grafik tren akan muncul secara otomatis setelah suara masuk mulai terekam.
@endif
Hasil Perolehan Suara
@php
$rank = 1;
$maxVotes = $rankedCandidates->first()->votes_count ?? 1;
if ($maxVotes <= 0) {
$maxVotes = 1;
}
@endphp
@forelse($rankedCandidates as $candidate)
@php
$ratio = $candidate->votes_count / $maxVotes;
// Blended formula: 25% linear + 75% power-scaled (exponent 18) to stretch small vote gaps
// dynamically, ensuring close candidates have highly visible bar length differences
// while lower tier candidates still display proportional widths.
$barWidth = (0.25 * $ratio + 0.75 * pow($ratio, 18)) * 100;
$barColorClass = 'bg-rank-default';
if ($rank == 1) $barColorClass = 'bg-rank-1';
elseif ($rank == 2) $barColorClass = 'bg-rank-2';
elseif ($rank == 3) $barColorClass = 'bg-rank-3';
@endphp