Skip to content

reports: a doughnut labels shares and names its slices - #7090

Merged
delchev merged 1 commit into
masterfrom
issue-7076-doughnut-share-legend
Sep 7, 2026
Merged

reports: a doughnut labels shares and names its slices#7090
delchev merged 1 commit into
masterfrom
issue-7076-doughnut-share-legend

Conversation

@delchev

@delchev delchev commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #7076

BillableSplit (dimensions: [billable], measures: ["sum(hours)"], chart: doughnut) rendered one blue ring labelled 336% - the hours sum with a percent sign - and no legend saying which segment was billable.

Causes

  1. No legend. The generated report page set legend: series.length > 1. That is right for a bar or line chart, where the legend names the series; it is wrong for a circular chart, which slices ONE measure by the dimension - there the legend is the only thing that names the slices, so a single-measure doughnut lost its only key.
  2. "336%". Harmonia's renderPie draws the slice's raw value with a percent sign instead of the share it already computes. Fixed upstream in Chart: a pie/doughnut slice label is a share of the total, not the raw value codbex/harmonia#113; the pinned 2.14.2 still has it.

Change

  • A circular chart (pie, doughnut, polarArea) always keeps its legend, and each legend entry carries the slice's share of the measure total - Billable - 84%, Non-billable - 16%.
  • Shares are computed only when the fetched rows are the whole (filtered) result. A dashboard tile fetches a window, and a page-local share is not the report's - the same rule the table footer already applies to its totals.
  • Pie and doughnut pass dataLabels: false, so the value-as-percentage label is gone until the pinned Harmonia carries the upstream fix. Polar area labels values by design and keeps them.
  • A boolean dimension reads Yes/No in the chart instead of the raw true/false, from two new shell.report.* keys (en-US + bg-BG).
  • The entity report chart page (REPORT_PIE / REPORT_DOUGHNUT / REPORT_POLARAREA) gets the same treatment - it had the second half of the problem.

Verification

OrdersByCustomer in IntentEngineIT's intent gains chart: doughnut, and the report-file stack test asserts the generated page's chart type, legend, share labels and suppressed data label.

Tests run: 67, Failures: 0, Errors: 0, Skipped: 0 -- IntentEngineIT

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.
@delchev
delchev merged commit 68ffad9 into master Sep 7, 2026
10 checks passed
@delchev
delchev deleted the issue-7076-doughnut-share-legend branch September 7, 2026 05:28
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.

reports: doughnut chart prints the measure sum as a percentage ('336%') and has no legend for the dimension

1 participant