Skip to content

Add chart animation timing and donut hover callback - #2440

Merged
ravikiranvm merged 2 commits into
mainfrom
sync/ops-4728-chart-animation-hover
Aug 21, 2026
Merged

Add chart animation timing and donut hover callback#2440
ravikiranvm merged 2 commits into
mainfrom
sync/ops-4728-chart-animation-hover

Conversation

@ravikiranvm

@ravikiranvm ravikiranvm commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes OPS-4728.

Summary

  • Shares a single animation duration/easing (CHART_ANIMATION_DURATION_MS, CHART_ANIMATION_EASING) across BarChart and DonutChart so side-by-side charts finish transitions at the same pace — recharts defaults differ per element (Bar 400ms, Pie 800ms, Line 1500ms)
  • Fixes BarChart XAxis label clipping by reserving height={40} for the axis (default 30px isn't enough for the 20px tickMargin plus label text)
  • Adds an optional onSliceHover callback to DonutChart for hover-driven UI (e.g. swapping a center label on hover)

Shares one animation duration/easing across BarChart and DonutChart
(recharts defaults differ per element, so side-by-side charts finished
transitioning at different times), fixes BarChart XAxis label clipping,
and adds an optional onSliceHover callback to DonutChart.

Ported from openops-cloud/openops-internal#992.
Copilot AI lite review requested due to automatic review settings August 21, 2026 07:10
@linear

linear Bot commented Aug 21, 2026

Copy link
Copy Markdown

OPS-4728

Copilot AI 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.

Pull request overview

This PR updates the ui-components chart primitives to align Recharts animation timing between BarChart and DonutChart, fixes X-axis label clipping in BarChart, and introduces an optional onSliceHover callback in DonutChart for hover-driven UI.

Changes:

  • Introduce shared animation constants (CHART_ANIMATION_DURATION_MS, CHART_ANIMATION_EASING) and apply them to BarChart and DonutChart.
  • Reserve additional XAxis height in BarChart to prevent tick/label clipping.
  • Add DonutChart’s onSliceHover prop and wire it to Recharts hover events.

Blocking

  • DonutChart hover callback currently clears hover state on per-slice onMouseLeave, which can emit null when moving between slices and cause flicker for hover-driven UI. (See PR comment.)

Non-blocking

  • None

Merge recommendation

  • Do not merge

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/ui-components/src/ui/chart/chart.tsx Adds shared animation duration/easing constants for consistent cross-chart transitions.
packages/ui-components/src/ui/chart/bar-chart.tsx Applies shared animation settings to bars and increases XAxis height to avoid label clipping.
packages/ui-components/src/ui/chart/donut-chart.tsx Applies shared animation settings to pie and adds onSliceHover hover callback wiring.

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

Comment thread packages/ui-components/src/ui/chart/donut-chart.tsx
onMouseLeave on Pie fires per-sector, so crossing directly from one
slice into an adjacent one briefly clears the hover state before the
next slice's onMouseEnter sets it again. Move the clear to the
PieChart container's onMouseLeave instead.
@sonarqubecloud

Copy link
Copy Markdown

@ravikiranvm ravikiranvm changed the title Sync chart animation timing and donut hover callback Add chart animation timing and donut hover callback Aug 21, 2026
@ravikiranvm
ravikiranvm merged commit 62a1cf7 into main Aug 21, 2026
22 checks passed
@ravikiranvm
ravikiranvm deleted the sync/ops-4728-chart-animation-hover branch August 21, 2026 11:08
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.

3 participants