Fix multiline tooltip clipping - #913
Conversation
Expected version change and release notes:1.16.0-dev.16 (v1.16.0-dev.15...fix-multiline-tooltip-clipping ) (2026-08-19T12:35 UTC)Fixes
|
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-913.westus2.2.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR addresses tooltip clipping in MultiLineChart by introducing reusable, unit-testable tooltip positioning geometry and applying it to the chart’s per-point hover tooltip so it stays within plot bounds while keeping the tail anchored to the hovered point.
Changes:
- Added a pure
computeTooltipBoxLayoututility to compute clamped/flip tooltip box geometry within plot bounds. - Updated
MultiLineChartto use the new layout function for tooltip path/text positioning (including edge sliding and vertical flipping). - Added Vitest unit tests covering centered, edge, flip, corner, and fallback behaviors for the layout utility.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/chartTooltipLayout.ts | New pure geometry helper for computing tooltip box/tail layout within plot bounds |
| src/utils/chartTooltipLayout.test.ts | Unit tests for tooltip layout behavior across edge and fallback cases |
| src/components/MultiLineChart.tsx | Integrates computed tooltip layout to prevent clipping and keep tail anchored to the hovered point |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
point/bounds are absolute plot-pixel coordinates; only the returned layout is local to the anchor point. The previous header comment claimed all coordinates were anchor-local, which contradicted TooltipPlotBounds's own doc and could mislead callers. Addresses Copilot review comment on PR #913. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-913.westus2.2.azurestaticapps.net |
Summary
Related issues
Closes: #910
Testing
Checklist