Skip to content

fix: metric range voronoi clip#787

Merged
c-lamoureux merged 1 commit into
mainfrom
clipFix
May 8, 2026
Merged

fix: metric range voronoi clip#787
c-lamoureux merged 1 commit into
mainfrom
clipFix

Conversation

@c-lamoureux
Copy link
Copy Markdown
Contributor

Description

When a MetricRange child has hoverPoint: true and its metric values fall outside the y-axis domain (e.g. forecast values on a chart where scaleAxisToFit is false), hovering over the chart caused continuous flickering.

Two fixes:

  1. Voronoi y-encoding clampgetVoronoiYEncoding now clamps metric range seed points to [0, height] using clamp(scale(...), 0, height). An unclamped out-of-domain value (e.g. y = -600) produced a voronoi cell that dominated the entire chart area, causing every mouse movement to trigger a hover → layout recalculation loop.

  2. Domain filter on filteredTableForTooltipgetFilteredTooltipData now accepts an optional list of metric range hover metrics and excludes rows where the metric maps outside [0, height] on the y scale. This prevents tooltips and popovers from firing on rows that have no visible representation in the chart.

Related Issue

Motivation and Context

When MetricRange data is outside of the y domain, and scaleAxisToFit: false (the default), those values are not included in the y scale, and the resulting out-of-domain voronoi seeds caused the chart to flicker continuously on hover.

How Has This Been Tested?

  • Added a Storybook story (WithHoverPointsOutsideDomain under RSC/MetricRange) with forecast rows whose metric values (5000–9500) far exceed the historical y domain (~200–3738). Manually verified no flickering and no tooltips on the out-of-domain forecast points.
  • Added a second story (WithHoverPointsAtDomainBoundary) where the first forecast metric value sits exactly at the top of the y domain (4000). Manually verified that the hover point renders fully and is not clipped.
  • Updated unit tests in lineMarkUtils.test.ts to assert the clamped voronoi signal expression.
  • Updated unit tests in scatterSpecBuilder.test.ts to assert the domain-check filter expression on filteredTableForTooltip.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

@c-lamoureux c-lamoureux merged commit 92b6abf into main May 8, 2026
6 checks passed
@c-lamoureux c-lamoureux deleted the clipFix branch May 8, 2026 14:36
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.

2 participants