Skip to content

Fix traffic light plot rendering for single-study reviews with many domains#167

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-traffic-light-chart-generation
Draft

Fix traffic light plot rendering for single-study reviews with many domains#167
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-traffic-light-chart-generation

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 13, 2026

  • Identify root cause 1: facet_grid(space = "free") + degenerate y-axis limits = c(1, 1) → zero-height panels for single-study plots
  • Fix scale_y_continuous limits from c(1, 1) to c(0.5, 1.5) in theme_rob_tf (R/helpers.R)
  • Identify root cause 2: Generic/ROB1 caption lists every domain by name; with 21+ domains it exceeds the fixed base overhead, squashing the data circles
  • Fix get_height (R/helpers.R) to add max(0, ncol(data) - 9) * 0.15 in per extra domain for Generic/ROB1
  • Fix nrowspx (app.R) to add max(0, ncol(trafficdf) - 9) * 14 px per extra domain for on-screen display
  • Fix nrowsin (app.R) to add same proportional adjustment for download height
  • Wire nrowsin() into the downloadtrafficlightplot handler — it was computed but never passed to rob_save(), so the download was still using the old unpadded rec_height
  • Final code review and CodeQL scan passed

… y-axis limits

When scale_y_continuous(limits = c(1, 1)) was combined with facet_grid(space = "free"),
the zero y-range caused the single panel to receive zero height for a 1-study dataset,
making all data points invisible. Changing to c(0.5, 1.5) ensures a non-zero range so
space="free" correctly allocates positive panel height for any number of studies.

Agent-Logs-Url: https://github.com/mcguinlu/robvis/sessions/b156e993-19e3-46bd-a3b7-e5cb7337bcd0

Co-authored-by: mcguinlu <41202585+mcguinlu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix traffic light chart not generated for single study Fix traffic light plot rendering for single-study reviews Apr 13, 2026
Copilot AI requested a review from mcguinlu April 13, 2026 11:21
@mcguinlu
Copy link
Copy Markdown
Owner

@copilot I actually think the issue here is that the data uploaded in the issue has >20 domains, which means that the legends is very large and so the actual plot is squished by the autosizing function. Can you take a look and see if I am right, and if so, add some code to handle very large numbers of domains?

The caption lists every domain name on its own line. For 21+ domains this can
exceed the fixed 200px/2.5in base overhead, leaving no vertical space for the
actual data circles. Add max(0, ncols-9)*14px (screen) / *0.15in (file) per
extra domain column in nrowspx, nrowsin (app.R) and get_height (helpers.R).

Agent-Logs-Url: https://github.com/mcguinlu/robvis/sessions/bb9d4318-a9a3-4cc3-ba00-78235bba2da3

Co-authored-by: mcguinlu <41202585+mcguinlu@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Apr 14, 2026

@copilot I actually think the issue here is that the data uploaded in the issue has >20 domains, which means that the legends is very large and so the actual plot is squished by the autosizing functio...

You're right — with 21+ domains the caption (which lists every domain by name, one per line) exceeds the fixed 200px/2.5in overhead entirely, leaving zero vertical space for the actual data circles.

Fixed in commit 5058eff:

  • R/helpers.R (get_height): adds max(0, ncol(data) - 9) * 0.15 inches per extra domain column for Generic/ROB1 tools. For 23 columns (21 domains + Study + Overall) this adds 2.1 in, bringing a single-study plot from 2.9 in → 5.0 in.
  • robvisapp/app.R (nrowspx): adds the equivalent max(0, ncol(trafficdf) - 9) * 14 px for the on-screen display (240 px → 436 px for the reported case).
  • robvisapp/app.R (nrowsin): same proportional adjustment for the download-height reactive.

The baseline of 9 columns and 0.15 in/14 px per extra domain are kept consistent across all three locations and commented with the pixel↔inch relationship.

Copilot AI changed the title Fix traffic light plot rendering for single-study reviews Fix traffic light plot rendering for single-study reviews with many domains Apr 14, 2026
@mcguinlu
Copy link
Copy Markdown
Owner

@copilot - this seems to be working now for the in-app version, but the downloaded version of the image is still squashed (no data circles)

nrowsin was defined (and updated to include per-domain height adjustment) but
was never passed to rob_save(). The download handler was relying solely on
rob_object$rec_height. Now passes height = nrowsin() explicitly so the
domain-count-aware height is applied when saving the downloaded plot.

Agent-Logs-Url: https://github.com/mcguinlu/robvis/sessions/ba4a35e8-c33c-40af-a228-56524664a5bf

Co-authored-by: mcguinlu <41202585+mcguinlu@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Apr 14, 2026

@copilot - this seems to be working now for the in-app version, but the downloaded version of the image is still squashed (no data circles)

Found it — nrowsin (the reactive that computes the download height with the per-domain adjustment) was being computed correctly but was never actually passed to rob_save(). The download handler was falling back to rob_object$rec_height, which didn't include the domain-count padding.

Fixed in commit 54f7d5b by passing height = nrowsin() explicitly to rob_save() in the download handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Traffic light chart not generated when SR has only one study

2 participants