Skip to content

feat: Added KPI variation pills#1243

Open
ad4mou wants to merge 4 commits into
mainfrom
feat/enrich-kpi-charts-with-variation-pills-1180
Open

feat: Added KPI variation pills#1243
ad4mou wants to merge 4 commits into
mainfrom
feat/enrich-kpi-charts-with-variation-pills-1180

Conversation

@ad4mou

@ad4mou ad4mou commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • KPI cards can now show a small change pill under the number, comparing the latest period to the one before it.
  • Three styles: percentage (+20%, green/red with arrow), variation (signed change, green/red with arrow), and absolute (just the magnitude, no color/arrow) - or you can hide it.
  • The pill names the period it compares against -> "vs. last month / last week / last quarter / last year", inferred from the data's dates (falls back to "vs. previous period" when spacing is unclear; handles month-only and datetime values).
  • Style is switchable from the chart's edit dialog, shown only when a variation pill can actually be added.
  • The agent is guided to return a metric across consecutive periods and turn the pill on when a period-over-period change is worth showing.

Fixes

  • KPI cards with no x_axis_key were silently dropped when parsing stories (blank cards) -> now parsed correctly.
  • The edit pencil button no longer floats above KPI cards; it sits in the card's top-right corner.
CleanShot 2026-07-22 at 16 39 09@2x

Closes #1180

Review in cubic

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

URL https://pr-1243-cf0d7f3.preview.getnao.io
Commit cf0d7f3

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/shared/src/story-segments.ts
Comment thread apps/shared/src/chart-builder.tsx
Comment thread apps/frontend/src/components/tool-calls/display-chart-edit-dialog.tsx Outdated
Comment thread apps/shared/tests/chart-builder.test.tsx
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.

Enrich single number component with variation pills

2 participants