Repository navigation
[NoQA][Insights Polish] Update line chart's line, points and hover - #103050
cristipaval merged 9 commits into
Conversation
|
@MelvinBot review |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
ReviewThe approach looks good. Reading the hovered point from shared values keeps hover off the JS thread, and moving the line constants into 🐛 Hover stops working when the chart has one data point
Fix: read the width from the scale instead of React state, for example: With one point, any x in the plot belongs to it, so the full range width is the correct band. Nits
|
|
🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
JmillsExpensify
left a comment
There was a problem hiding this comment.
This is looking really great. Going to approve! This is ready to be reviewed by C+, though let's make sure that we get design feedback before merging.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-10-06.at.10.12.42.movAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-10-06.at.10.08.16.mov |
| const dx = args.cursorX - args.targetX; | ||
| const dy = args.cursorY - args.targetY; | ||
| return Math.sqrt(dx * dx + dy * dy) <= DOT_RADIUS + DOT_HOVER_EXTRA_RADIUS; | ||
| return Math.abs(args.cursorX - args.targetX) <= bandHalfWidth.get() && args.cursorY >= plotTop.get() && args.cursorY <= args.chartBottom; |
There was a problem hiding this comment.
Band leaks into the y-axis label area
The first point's band extends bandHalfWidth left of bounds.left, so hovering/clicking the y-axis labels shows the tooltip and navigates to the first period.
Should we also clamp cursorX to the plot's left/right bounds here?
Screen.Recording.2026-10-06.at.10.24.29.mov
There was a problem hiding this comment.
Should we also clamp cursorX to the plot's left/right bounds here?
Not sure
@dannymcclain thanks for the catches! Both done. Will update PR description with new screenshots after addressing other review comments |
In practice, the issue doesn't reproduce, but it's true that the current implementation is prone to this bug. I've applied the suggested change.
I didn't add any JSDoc comments to these props because I figured their names were self-explanatory.
True, the change is not really directly related. Reverted! |
|
@JmillsExpensify @Expensify/design I've got a question that came from @truph01. Should hovering near the side edges of the chart still highlight the first/last point? Right now each point has a hover band centered on it, so for the first and last points band sticks out past the plot area. On one hand there's no chart there anymore, so catching the point feels a little unexpected. On the other hand it feels kind of intuitive to me that the hover is not only on one side of the point. Right now it looks like this: Screen.Recording.2026-10-06.at.15.30.56.mov |
|
Yeah it does feel a little unexpected for the far right one when you're hovering over the Y-Axis. But tbh I don't hate it. Curious for @JmillsExpensify's take. Do y'all think it'd be better to limit the hover areas to be contained within the plot area, basically within this red rectangle?
|
Yeah, I think it would be ideal to limit the hover areas to be contained within the plot area. We can also merge though and address it later. Depends on if @OlGierd03 is still online for the day. |
|
I am and I'm on it. The change should be ready in a few minutes |
|
@JmillsExpensify @dannymcclain I've applied the changes, so the hover should now work as expected. I've also updated the video and the screenshot in the PR description. It shows how the hover area looks like now. Mentioned video: Screen.Recording.2026-10-06.at.17.15.43.mov |
|
That looks great. @dannymcclain you good? |
|
It looks good now: Screen.Recording.2026-10-06.at.22.31.48.mov |
|
Yeah that looks good to me! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 cristipaval has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.5.4-0 🚀
|
|
No help site update is needed. This PR changes how the Spend over time line chart looks and responds to hover (thicker line, no resting dots, column-wide hover). No article under |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.4-3 🚀
Bundle Size Analysis (Sentry): |







Explanation of Change
The Spend over time line is now
4pxwide with rounded ends, and it no longer draws dots at rest. Hovering anywhere in a period's full-height column shows the tooltip, a dot on the line and a vertical guideline. Before, the cursor had to be over the dot itself.The dot and the guideline are drawn by the new
ActivePointIndicator, which reads the hovered point from a newactivePointPositionvalue returned byuseChartInteractions. Because of this, hovering doesn't re-render the chart.ScatterPointsis removed, since the line chart was its only consumer.Fixed Issues
$ #102862
Tests
Precondition: account with the insightsPage beta and expenses in at least a few months of the current year.
4pxwide with rounded ends and no dots are drawn on it.Offline tests
N/A
QA Steps
NoQA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
Screen.Recording.2026-10-06.at.17.15.43.mov