Pie chart: surplus slivers close smoothly; residual surplus no longer a labeled candidate - #630
Open
skaphan wants to merge 2 commits into
Open
Pie chart: surplus slivers close smoothly; residual surplus no longer a labeled candidate#630skaphan wants to merge 2 commits into
skaphan wants to merge 2 commits into
Conversation
When an elected candidate's surplus transfers, the hatched sliver was deleted at full size at the start of the consolidate phase — a white gap in the pie that neighboring slices then closed over. The closing data now carries the transfer sub-slice as a zero-value entry, so the same angular tween that closes eliminated candidates' slices closes the sliver too. Bundle built from rcv-pie-chart acb3dd7 (source fix in PieChartGraphics.svelte updatePie). Co-Authored-By: Claude Fable 5
Owner
Contributor
Author
|
To see the issue, use Sample Data: Multi-Winner Example <https://www.rcvis.com/v/macomb-multiwinner-surplusjson-3> rcvis.com's real world data page. When it transfers surplus in round 2, it leaves a white gap.
I'll look into the other issue you mentioned here.
… On Aug 10, 2026, at 6:12 AM, Armin Samii ***@***.***> wrote:
artoonie
left a comment
(artoonie/rcvis#630)
<#630 (comment)>
I'm testing this looking at the 2013 Minneapolis Park but don't see the white gap you're referring to -- the only surplus transfer is round 10->11 and the gap is too small to notice anything. Can you help me find the issue you encountered?
Separately, while testing this, I noticed an odd behavior:
On the macomb-multiwinner config, if you load the page on the "Bar" tab, then switch to "Pie", the words overlap. If you refresh the page on "Pie" or change rounds, the issue does not appear.
Image: Screenshot 2026-08-10 at 9 11 11 AM (view on web) <https://github.com/user-attachments/assets/acc3893b-ff9c-4089-aa33-f8f32e27496e>
macomb-multiwinner_ouALmBP.json <https://github.com/user-attachments/files/30900186/macomb-multiwinner_ouALmBP.json>
—
Reply to this email directly, view it on GitHub <#630?email_source=notifications&email_token=AABCNY6GXJMAO3KS7KXFN6L5JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5240756668>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABCNY2AHWRJBP4AYRFQI4L5JHC4TAVCNFSNUABFKJSXA33TNF2G64TZHMYTMMZRGM4DGMBUHNEXG43VMU5TKMBRGY2DSMJZGE32C5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS <https://github.com/notifications/mobile/ios/AABCNYYEQYYYATOMKO3NJTD5JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android <https://github.com/notifications/mobile/android/AABCNYZ6PUZU4Z3TGIV4AA35JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today!
You are receiving this because you authored the thread.
|
Contributor
Author
|
This is a very interesting bug. The pie chart filters out "residual surplus" but not "Residual Surplus", so it makes it into the candidate display.
The reason the labels overlap is apparently because the bounding boxes for the text are measured early, before the container is rendered, and they are zero
width so the overlap is not detected. AND this only happens when the random candidate order happens to put the residual surplus slice
at the end, next to Inactive Ballots. Ordinarily, very small slices would not exist on the final round, which is the first round that rcvis shows.
I'll fix it so it recognizes both capitalizations and then that problem should go away. I don't want to mess with
lifecycle fixes that would redisplay the text as that seems likely to cause other problems.
… On Aug 10, 2026, at 6:12 AM, Armin Samii ***@***.***> wrote:
artoonie
left a comment
(artoonie/rcvis#630)
<#630 (comment)>
I'm testing this looking at the 2013 Minneapolis Park but don't see the white gap you're referring to -- the only surplus transfer is round 10->11 and the gap is too small to notice anything. Can you help me find the issue you encountered?
Separately, while testing this, I noticed an odd behavior:
On the macomb-multiwinner config, if you load the page on the "Bar" tab, then switch to "Pie", the words overlap. If you refresh the page on "Pie" or change rounds, the issue does not appear.
Image: Screenshot 2026-08-10 at 9 11 11 AM (view on web) <https://github.com/user-attachments/assets/acc3893b-ff9c-4089-aa33-f8f32e27496e>
macomb-multiwinner_ouALmBP.json <https://github.com/user-attachments/files/30900186/macomb-multiwinner_ouALmBP.json>
—
Reply to this email directly, view it on GitHub <#630?email_source=notifications&email_token=AABCNY6GXJMAO3KS7KXFN6L5JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5240756668>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABCNY2AHWRJBP4AYRFQI4L5JHC4TAVCNFSNUABFKJSXA33TNF2G64TZHMYTMMZRGM4DGMBUHNEXG43VMU5TKMBRGY2DSMJZGE32C5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS <https://github.com/notifications/mobile/ios/AABCNYYEQYYYATOMKO3NJTD5JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android <https://github.com/notifications/mobile/android/AABCNYZ6PUZU4Z3TGIV4AA35JHC4TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRUGA3TKNRWGY4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today!
You are receiving this because you authored the thread.
|
Fixes the overlapping-labels behavior reported in review (Eastpointe / macomb-multiwinner): rcvis injects residual surplus into the tally as a "Residual Surplus" pseudo-candidate, which the component treated as an ordinary candidate — a near-zero slice, shuffled among the real ones, labeled, and counted in the active-votes denominator. When the shuffle seated it beside the end-pinned Inactive Ballots slice, the two labels superimposed at the top of the pie. The component now recognizes residual surplus case-insensitively (raw RCTab files carry it lowercase, as a transfer destination only) and drops it entirely: no slice, no label, excluded from the live-votes denominator, and transfer references to it are absorbed silently. A stranded rounding remainder is held by nobody, so a wedge too thin to see no longer gets a label pointing at nothing. Source change in the pie component's candidate-order / active-votes / transfer paths; verified against this election's data with the rcvis- style tally injection reproduced. Co-Authored-By: Claude Fable 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Two pie fixes, one found during review of the other.
1. Surplus slivers close smoothly instead of leaving a white gap
When an elected candidate's surplus transfers, the grayed-out sliver of their slice was removed at full size at the start of the consolidate phase, leaving a white gap that neighboring slices then closed over. The pie bundle now retains the transfer sub-slice as a zero-value entry in the closing transition's data, so the keyed data join tweens it shut instead of exit-removing it at full size.
Correction to the original description (and to @artoonie's question above — sorry for the wild-goose chase): I claimed the 2013 Minneapolis Park Board election had three surplus rounds. It has one (round 9→10, ~1,829 votes, about 3.9% of the pie), which is why the gap was hard to spot there. The best data for seeing the original bug is this repo's own macomb-multiwinner (Eastpointe 2019): round 4's surplus transfers 50.9 of 400 votes, so the disappearing sliver is ~12.7% of the circle — unmissable. Round 2 shows the small-sliver case (10 votes).
2. Residual surplus no longer appears as a candidate (the overlapping-labels screenshot)
The overlap @artoonie found while testing turned out to be a second, separate bug, and this branch now fixes it too.
rcvis injects residual surplus into the tally as a
Residual Surpluspseudo-candidate. The component only knew the lowercaseresidual surplusform that raw RCTab files carry (as a transfer destination), so the title-cased tally entry walked past every check and was treated as an ordinary candidate: it got a slice, a color, a label, a place in the active-votes denominator — and a position in the slice shuffle.Inactive Ballotsis pinned to the end of the slice order; whenever the shuffle happened to seatResidual Surplusin the last active position (~1-in-5 for this field size), the two near-zero slices sat adjacent at 12 o'clock and their labels superimposed. That's the screenshot.The component now recognizes residual surplus case-insensitively and drops it entirely: no slice, no label, excluded from the live-votes denominator, transfer references absorbed silently. A stranded rounding remainder (0.0224 votes here) is held by nobody; a wedge too thin to see shouldn't get a label pointing at nothing.
One caveat for completeness: the label overlap-suppression logic measures text with
getBBox(), which returns 0×0 when the chart is initialized while hidden (e.g. load on the Bar tab, then switch to Pie) — so on that path suppression is inert for any coincident labels, independent of this fix. With the residual gone this election has no coincident pair left, but that's a separate, smaller issue; happy to address it separately if you'd like.Test plan
macomb-multiwinner(Eastpointe 2019); pie shows no Residual Surplus slice or label in any round; Inactive Ballots labeled normally from round 4🤖 Generated with Claude Code