-
Notifications
You must be signed in to change notification settings - Fork 43
CODAP-899 Boxplot hover tip improvement #2267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* A reasonable solution is to display values for both measures when they are equal. We accomplish this through manipulation of the array of hints that gets turned into the labels displayed on hover.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2267 +/- ##
==========================================
- Coverage 86.67% 86.65% -0.02%
==========================================
Files 721 721
Lines 38384 38393 +9
Branches 9488 9501 +13
==========================================
+ Hits 33269 33270 +1
- Misses 4811 4818 +7
- Partials 304 305 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
codap-v3
|
||||||||||||||||||||||||||||
| Project |
codap-v3
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 07m 53s |
| Commit |
|
| Committer | William Finzer |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
48
|
|
|
0
|
|
|
283
|
| View all changes introduced in this branch ↗︎ | |
There was a problem hiding this comment.
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 fixes a bug where the box plot median value was not visible in hover tooltips when it equaled Q1 or Q3. The solution modifies the hover tooltip to display both measure labels when their values are equal.
Key Changes:
- Added special case handling for when median equals lower or upper quartile
- Combines labels for equal measures by manipulating the tooltip content array
Comments suppressed due to low confidence (1)
v3/src/components/graph/adornments/univariate-measures/box-plot/box-plot-adornment-component.tsx:1
- The code assumes a specific array structure based on index positions (1, 2, 3) without validation. If the tooltip format changes or has fewer entries than expected, this could cause undefined behavior. Consider adding a guard to verify contentArray has the expected number of elements before accessing specific indices.
import React, { useCallback, useMemo, useRef } from "react"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...rc/components/graph/adornments/univariate-measures/box-plot/box-plot-adornment-component.tsx
Outdated
Show resolved
Hide resolved
kswenson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good, but two concerns:
- I think Copilot is right that this won't handle the case where lower === median === upper correctly. Its suggestion about splicing the array is bogus, however, so you can't just take its suggestion.
- I'm leery of the floating-point equality comparison issue. What we really want is to determine whether neighboring values fall on the same pixel in screen coordinates. This could miss cases where the values aren't numerically identical but fall on the same pixel anyway. If that's not an easy thing to determine, however, perhaps a TODO in the code reminding us to return here would be sufficient.
kswenson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
[#CODAP-899] Bug fix: Box plot median is hidden when equal to Q1