Skip to content

Conversation

@bfinzer
Copy link
Contributor

@bfinzer bfinzer commented Dec 19, 2025

[#CODAP-899] Bug fix: Box plot median is hidden when equal to Q1

  • 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.

* 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
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.65%. Comparing base (90e2277) to head (96529fc).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...measures/box-plot/box-plot-adornment-component.tsx 11.11% 7 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
cypress 72.25% <11.11%> (-0.01%) ⬇️
jest 55.18% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Dec 19, 2025

codap-v3    Run #9391

Run Properties:  status check passed Passed #9391  •  git commit 9b72c487ea: Merge pull request #2267
Project codap-v3
Branch Review main
Run status status check passed Passed #9391
Run duration 07m 53s
Commit git commit 9b72c487ea: Merge pull request #2267
Committer William Finzer
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 48
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 283
View all changes introduced in this branch ↗︎

@kswenson kswenson requested a review from Copilot December 19, 2025 01:56
Copy link
Contributor

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

Copy link
Member

@kswenson kswenson left a 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:

  1. 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.
  2. 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.

Copy link
Member

@kswenson kswenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@bfinzer bfinzer merged commit 9b72c48 into main Dec 20, 2025
19 of 21 checks passed
@bfinzer bfinzer deleted the CODAP-899-boxplot-hover-tip-v3 branch December 20, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants