@@ -411,14 +411,21 @@ 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
414+ // Special case in which median equals lower and/or upper quartile
415+ // We combine the labels for those two or three measures so the user sees all info
416+ // Todo: We're not handling the situation in which the measures are very close to each other.
417+ // Consider basing equality on the threshold of one pixel difference
418+ // Todo: We're also not handling equality of min/max whisker with quartiles or median. (Not a common case.)
416419 if ( lowerQuartile === median || median === upperQuartile ) {
417420 const contentArray = textContent . split ( "\n" )
418- if ( lowerQuartile === median ) {
421+ if ( lowerQuartile === median && median === upperQuartile ) {
422+ // It turns out the third array element is the one that displays in this situation
423+ contentArray [ 3 ] = `${ contentArray [ 1 ] } ; ${ contentArray [ 2 ] } ; ${ contentArray [ 3 ] } `
424+ }
425+ else if ( lowerQuartile === median ) {
419426 contentArray [ 1 ] = `${ contentArray [ 1 ] } ; ${ contentArray [ 2 ] } `
420427 }
421- if ( median === upperQuartile ) {
428+ else if ( median === upperQuartile ) {
422429 contentArray [ 3 ] = `${ contentArray [ 2 ] } ; ${ contentArray [ 3 ] } `
423430 }
424431 textContent = contentArray . join ( "\n" )
0 commit comments