Skip to content

Commit 025b369

Browse files
committed
[#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.
1 parent 91d1fea commit 025b369

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

v3/src/components/graph/adornments/univariate-measures/box-plot/box-plot-adornment-component.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,18 @@ export const BoxPlotAdornmentComponent = observer(function BoxPlotAdornmentCompo
411411
const translationVars = [ minWhiskerValue, lowerQuartile, median, upperQuartile, maxWhiskerValue, iqr ]
412412
.map(v => helper.formatValueForScale(v))
413413
let textContent = `${t(model.labelTitle, { vars: translationVars })}`
414+
// Special case in which median equals lower or upper quartile
415+
// We combine the labels for those two measures so the user sees both
416+
if (lowerQuartile === median || median === upperQuartile) {
417+
const contentArray = textContent.split("\n")
418+
if (lowerQuartile === median) {
419+
contentArray[1] = `${contentArray[1]}; ${contentArray[2]}`
420+
}
421+
if (median === upperQuartile) {
422+
contentArray[3] = `${contentArray[2]}; ${contentArray[3]}`
423+
}
424+
textContent = contentArray.join("\n")
425+
}
414426

415427
if ((measureRange?.min || measureRange?.min === 0) && (measureRange?.max || measureRange?.max === 0)) {
416428
const rangeSpecs = {

0 commit comments

Comments
 (0)