Skip to content

feat(components/charts): add pie and donut chart components - #4584

Draft
Blackbaud-SteveBrush wants to merge 2 commits into
14.x.xfrom
14.x.x_pie-chart
Draft

Blackbaud-SteveBrush wants to merge 2 commits into
14.x.xfrom
14.x.x_pie-chart

Conversation

@Blackbaud-SteveBrush

@Blackbaud-SteveBrush Blackbaud-SteveBrush commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added pie and donut charts with configurable labels, values, formatting, currencies, tooltips, themes, and accessible summaries.
    • Added data-table access through the chart context menu.
    • Added basic, formatted-value, donut, and asynchronous chart examples with loading and reload states.
    • Added playground pages and documentation for the new chart options.
  • Testing

    • Added testing harness support and comprehensive coverage for chart rendering, accessibility, formatting, themes, and empty states.

@Blackbaud-SteveBrush Blackbaud-SteveBrush added the risk level (author): 1 No additional bugs expected from this change label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5ce0ac95-bff9-406c-86fa-c7056302830f

📥 Commits

Reviewing files that changed from the base of the PR and between 0811182 and 3fce954.

📒 Files selected for processing (4)
  • libs/components/charts/src/assets/locales/resources_en_US.json
  • libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts
  • libs/components/charts/src/lib/chart-pie/chart-pie.ts
  • libs/components/charts/src/lib/shared/sky-charts-resources.module.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/components/charts/src/assets/locales/resources_en_US.json
  • libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts

📝 Walkthrough

Walkthrough

This PR adds SkyChartPie with pie and donut modes, projected slices, formatting, accessibility data, theming, Chart.js integration, and a testing harness. It also adds code examples, playground coverage, Storybook stories, localization, documentation metadata, and workflow guidance.

Changes

Pie chart feature

Layer / File(s) Summary
Chart component and rendering
libs/components/charts/src/lib/chart-pie/*, libs/components/charts/src/lib/chart-js/chart-js.ts, libs/components/charts/src/lib/shared/*, libs/components/charts/src/index.ts
Adds pie and donut rendering, slice inputs, value formatting, accessible summaries, data-table output, theme-aware arc styling, Chart.js registration, public exports, and component tests.
Chart harness
libs/components/charts/testing/src/modules/chart-pie/*, libs/components/charts/testing/src/public-api.ts
Adds SkyChartPieHarness, filtering support, rendered-state detection, public exports, and tests for populated and empty charts.
Code examples and documentation
libs/components/code-examples/src/lib/modules/charts/chart-pie/*, libs/components/code-examples/src/index.ts, libs/components/code-examples/routes/src/index.ts, libs/components/charts/documentation.json
Adds basic, donut, and asynchronous examples with tests, exports, lazy routes, and documentation metadata.
Playground coverage
apps/playground/src/app/components/charts/chart-pie/*, apps/playground/src/app/components/charts/charts.routes.ts, .github/skills/add-skyux-component/SKILL.md
Adds a playground page with basic, currency-formatting, and asynchronous variants. The page supports pie and donut mode selection. The component workflow now requires playground registration and verification.
Storybook stories
apps/e2e/charts-storybook/src/app/chart-pie/*
Adds regional and channel-revenue charts with pie and donut stories.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant SkyChartPie
  participant SkyChartPieSlice
  participant Chart.js
  participant AccessibilityData
  Consumer->>SkyChartPie: Provide display mode and projected slices
  SkyChartPie->>SkyChartPieSlice: Read label and value inputs
  SkyChartPie->>Chart.js: Build pie or donut configuration
  Chart.js-->>SkyChartPie: Render chart canvas
  SkyChartPie->>AccessibilityData: Publish formatted summary and table data
Loading

Possibly related PRs

Suggested reviewers: johnhwhite, blackbaud-trevorburch

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the addition of pie and donut chart components, which is the main change in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 14.x.x_pie-chart

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 3fce954

Command Status Duration Result
nx build code-examples-playground --baseHref=ht... ✅ Succeeded 3m 38s View ↗
nx build playground --baseHref=https://blackbau... ✅ Succeeded 1m 35s View ↗
nx build integration --baseHref=https://blackba... ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-04 18:45:49 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts (1)

269-276: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the percent value format.

chart-pie.ts lines 87-92 document that percent expects fractional values, so 0.25 displays as 25%. The spec covers number and currency only. Add a percent case so the documented conversion stays verified.

💚 Proposed test addition
+  it('should format the tooltip value as a percent', () => {
+    component.valueFormat = 'percent';
+    fixture.detectChanges();
+
+    const label = getTooltipLabel(requireChart());
+    expect(label(tooltipContext('North', 0.25))).toBe('North: 25%');
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts` around lines 269
- 276, Add a test case alongside the existing value-format specs in the
chart-pie test suite that sets valueFormat to percent, passes the fractional
value 0.25 through the tooltip label, and asserts it renders as 25%.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/components/charts/src/assets/locales/resources_en_US.json`:
- Around line 17-21: Update the pie chart accessibility resources and the
display-mode selection in chart-pie.ts: add a donut-specific accessible summary
key whose message announces “Donut chart” while preserving the slice count and
data-table information, then make displayMode select that key for donut charts
and retain the existing pie key for pie charts.

In `@libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts`:
- Around line 316-329: Update both a11y tests in the “a11y” describe block to
call fixture.detectChanges() before fixture.whenStable(), ensuring the pie and
donut configurations are rendered before accessibility assertions.

---

Nitpick comments:
In `@libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts`:
- Around line 269-276: Add a test case alongside the existing value-format specs
in the chart-pie test suite that sets valueFormat to percent, passes the
fractional value 0.25 through the tooltip label, and asserts it renders as 25%.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 16c622ff-6cae-49fd-a2b7-6c1478d6dd2f

📥 Commits

Reviewing files that changed from the base of the PR and between 3207614 and 0811182.

📒 Files selected for processing (41)
  • .github/skills/add-skyux-component/SKILL.md
  • apps/e2e/charts-storybook/src/app/chart-pie/chart-pie.component.html
  • apps/e2e/charts-storybook/src/app/chart-pie/chart-pie.component.scss
  • apps/e2e/charts-storybook/src/app/chart-pie/chart-pie.component.stories.ts
  • apps/e2e/charts-storybook/src/app/chart-pie/chart-pie.component.ts
  • apps/playground/src/app/components/charts/chart-pie/chart-pie-playground.html
  • apps/playground/src/app/components/charts/chart-pie/chart-pie-playground.ts
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-async-playground.html
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-async-playground.ts
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-basic-playground.html
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-basic-playground.ts
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-value-format-playground.html
  • apps/playground/src/app/components/charts/chart-pie/variants/chart-pie-value-format-playground.ts
  • apps/playground/src/app/components/charts/charts.routes.ts
  • libs/components/charts/documentation.json
  • libs/components/charts/src/assets/locales/resources_en_US.json
  • libs/components/charts/src/index.ts
  • libs/components/charts/src/lib/chart-js/chart-js.ts
  • libs/components/charts/src/lib/chart-pie/chart-pie-display-mode.ts
  • libs/components/charts/src/lib/chart-pie/chart-pie-slice.ts
  • libs/components/charts/src/lib/chart-pie/chart-pie.html
  • libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts
  • libs/components/charts/src/lib/chart-pie/chart-pie.ts
  • libs/components/charts/src/lib/shared/chart-theme-styles.ts
  • libs/components/charts/src/lib/shared/fixtures/theme-styles-fixture.ts
  • libs/components/charts/src/lib/shared/sky-charts-resources.module.ts
  • libs/components/charts/testing/src/modules/chart-pie/chart-pie-harness-filters.ts
  • libs/components/charts/testing/src/modules/chart-pie/chart-pie-harness.spec.ts
  • libs/components/charts/testing/src/modules/chart-pie/chart-pie-harness.ts
  • libs/components/charts/testing/src/public-api.ts
  • libs/components/code-examples/routes/src/index.ts
  • libs/components/code-examples/src/index.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/async/example.html
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/async/example.spec.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/async/example.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/basic/example.html
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/basic/example.spec.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/basic/example.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/donut/example.html
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/donut/example.spec.ts
  • libs/components/code-examples/src/lib/modules/charts/chart-pie/donut/example.ts

Comment thread libs/components/charts/src/assets/locales/resources_en_US.json
Comment thread libs/components/charts/src/lib/chart-pie/chart-pie.spec.ts
@blackbaud-sky-build-user

Copy link
Copy Markdown
Collaborator

This branch was previously deployed

1 inactive deployment
e2e-team-members 3fce954c Deployed Aug 4, 2026 by Blackbaud-SteveBrush via Environment Check #19022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk level (author): 1 No additional bugs expected from this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants