Chart: a pie/doughnut slice label is a share of the total, not the raw value - #113
Closed
delchev wants to merge 1 commit into
Closed
Chart: a pie/doughnut slice label is a share of the total, not the raw value#113delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
renderPie drew the slice's raw value with a percent sign appended, so a doughnut of one 336-hour slice read "336%" where the documented behaviour (and the already-computed `pct`) says "100%". Slices that happened to sum to 100 hid it, and so did the tests. Label with the share instead, one decimal below 10% so small-but-labelled slices stay distinguishable. Signed-off-by: delchev <delchevn@gmail.com>
delchev
added a commit
to eclipse-dirigible/dirigible
that referenced
this pull request
Sep 7, 2026
A `chart: doughnut` report drew one unlabelled ring whose only text was the measure sum with a percent sign - a 336-hour billable split read "336% billable" - and nothing said which segment was which. Two causes. The page turned the legend off unless there were several measure series (`legend: series.length > 1`), but a circular chart slices ONE measure by the dimension: its slices are the dimension values, and the legend is the only thing that names them. And the chart library prints a pie/doughnut slice's raw value with a percent sign appended instead of its share (codbex/harmonia#113). So: the legend is always on for a circular chart and each entry carries the slice's share of the measure total, computed only when the fetched rows are the whole result - a windowed dashboard tile must not present a page-local share as the report's, the rule the table footer already applies to its totals. Pie and doughnut also pass `dataLabels: false`, dropping the value-as-percentage label until the pinned Harmonia carries the fix; polar area, whose labels are values by design, keeps them. A boolean dimension now reads Yes/No in the chart rather than the raw true/false, from two new shell keys. The same treatment goes to the entity report chart page (REPORT_PIE / REPORT_DOUGHNUT / REPORT_POLARAREA), which had the second half of the problem. Verified by IntentEngineIT: OrdersByCustomer gains `chart: doughnut` and the report-file stack test asserts the generated page's legend, share labels and suppressed data label. 67 tests, all green.
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.
renderPieappended a percent sign to the slice's raw value:so a doughnut of one 336-hour slice renders 336%.
pct— the share — was already computed one line above (and used for the 5% sliver cut-off), and bothdocs/charts/pie.mdanddocs/charts/doughnut.mddescribedataLabelsas "each slice's percentage". The existing tests used slices summing to 100 (30/70), which hid it.Found downstream in Eclipse Dirigible's generated report pages, where a
sum(hours)doughnut told a manager "336% billable" (eclipse-dirigible/dirigible#7076).Fix: label with
pct, one decimal below 10% so a small-but-labelled slice (the 5–10% band) stays distinguishable. Polar area, which already labelled withformat(s.value), is unchanged — its labels are values by design.Tests: three added (share label with a non-100 total, single slice = 100%, one decimal under 10%). Full suite green: 3576 passed, 5 skipped.