Skip to content

feat: larger verification report pies - #979

Merged
antonkri merged 12 commits into
mainfrom
feat/report-pie-size
Oct 19, 2026
Merged

antonkri merged 12 commits into
mainfrom
feat/report-pie-size

Conversation

@antonkri

@antonkri antonkri commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📌 Description

The pie charts in the module and platform verification reports render very small, especially three per row on high-resolution screens. Sphinx-Needs draws every needpie at a fixed figsize=(8, 4) with the legend to the right, so the circle covers only ~35% of the image width; the rest is blank space that looks like a gap between the charts.

This PR draws the report pies with a dedicated score-report-pie directive, so the circle fills ~60% of its column (about 1.7x larger) and the slice numbers become much larger while a row keeps three pies:

  • _SafetyPieRow writes .. score-report-pie:: instead of .. needpie::, with a two-line chart title (<component/feature> <subject> / <chart> (<safety class>)).
  • score-report-pie (new module score_sphinx_needs_templates/report_pie.py) counts its slices exactly like needpie: one Sphinx-Needs filter per content line (evaluated with filter_needs_parts) or a :filter-func: called with needpie's convention (used by the module report for the score_metrics filter functions from Feat/centralize verification metrics #949), at doctree-resolved, after Sphinx-Needs has resolved all Needs. It then draws a 5x4 inch chart with the title and the slice numbers only: no legend and no slice labels, because both reports explain the slice colours once at the top of the page ("Legend — status values and chart colours"). Percentages and counts are 14pt bold, the title 13pt. The matplotlib settings are pinned while drawing and saving, so global styles (e.g. savefig.bbox = tight from score_sphinx_bundle, or reference_integration patching Axes.legend away) do not change the result. The image alt text lists every slice with its count. Slices between 2% and 5% carry their number at half size (7pt); only slices below 2% stay unnumbered.
  • needpie itself is not touched. Every other needpie and all needbar charts keep Sphinx-Needs' own layout. There is no global patch and no detection by title (this addresses why the earlier global legend patch was reverted in feat: split module report pies into ASIL and QM #946).
  • A safety class without any Need is shown as one slim dashed bar ("no QM requirements") under its heading instead of a row of three full-height placeholders. The report CSS targets img.score-report-pie.

Preview: eclipse-score/reference_integration#396

🚨 Impact Analysis

  • This change does not violate any tool requirements and is covered by existing tool requirements
  • This change does not violate any design decisions
  • Otherwise I have created a ticket for new tool qualification

✅ Checklist

  • Added/updated documentation for new or changed features
  • Added/updated tests to cover the changes
  • Followed project coding standards and guidelines

Split each report pie title into two lines and crop the now blank left 13% of the needpie image, so the charts grow by 15% while a row keeps three pies.
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-979: https://eclipse-score.github.io/docs-as-code/pr-979/

Sphinx-Needs draws every needpie at 8x4 inches with the legend beside it, so the circle covers only ~35% of the image width. Re-lay out only the pies written by safety_pie_row (recognised by their two-line title) as a 5x6 inch portrait chart with the legend underneath and without the duplicate slice labels. The circle now fills ~80% of its column. The CSS crop of the previous commit is dropped; other needpie charts stay untouched.
@antonkri antonkri changed the title feat: larger verification report pies via two-line titles feat: larger verification report pies Oct 16, 2026
antonkri and others added 6 commits October 16, 2026 11:01
Shrink the report pie circle from ~80% to ~60% of its column and set the percentages and counts inside the slices to 17pt bold, the legend to 12pt and the title to 13pt, so the numbers read well three charts per row.
reference_integration patches matplotlib's Axes.legend to a no-op, so report pies arrive without a legend and were left with 8pt numbers. Recognise the slice values by their Sphinx-Needs format and enlarge them regardless; slice labels stay visible when there is no legend to repeat them.
Both verification reports explain the slice colours once at the top of the page, so the per-chart legend and the slice labels only cost space. Report pies now show the two-line title and the enlarged slice numbers in a 5x4 inch figure, also where a project patches Axes.legend away.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removing category labels makes chart interpretation depend solely on colour, introducing an accessibility regression.

1 open finding
What changed in this PR

Enlarges verification-report pie charts while targeting the layout changes to report-specific titles.

Changes:

  • Adds two-line titles and compact charts with larger slice numbers.
  • Removes chart legends and slice labels; adjusts empty placeholders.
  • Adds tests for report-chart detection and layout behavior.
File Description
src/​needs_templates/​platform_verification_report.need Changes placeholder aspect ratio to 4:3.
src/​needs_templates/​module_verification_report.need Changes placeholder aspect ratio to 4:3.
src/​extensions/​score_sphinx_needs_templates/​tests/​test_needs_templates.py Tests titles, layout, and unrelated-chart preservation.
src/​extensions/​score_sphinx_needs_templates/​__init__.py Generates multiline titles and applies report-specific chart layouts.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +508 to +509
else:
text.set_visible(False)
Replace the global patch of needpie's save_matplotlib_figure, which picked the report pies by their title, with an explicit directive used only by safety_pie_row. It counts one Sphinx-Needs filter per content line like needpie and draws the compact report chart itself; every other needpie stays untouched.
A safety class without any Need rendered three full-height dashed placeholders. It now gets a single one-line bar under its heading, so empty rows take little space.
Slices between 2% and 5% now carry their percentage and count at half the font size; only slices below 2% stay unnumbered.
Resolve the conflict with #949 in _SafetyPieRow: the module report keeps counting through the score_metrics filter functions, now via score-report-pie, which gains :filter-func: support with needpie's calling convention. The needpie-only :legend: option is dropped.
@antonkri
antonkri merged commit cbb141a into main Oct 19, 2026
36 checks passed
@antonkri
antonkri deleted the feat/report-pie-size branch October 19, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants