Box charts hover only Q3, Mediana and Q1, through an invisible marker; the box itself takes no hover

This commit is contained in:
2026-12-03 17:32:41 -06:00
parent ebb8db0017
commit e93e807325
2 changed files with 16 additions and 2 deletions
+10 -1
View File
@@ -287,8 +287,17 @@ export function boxFigure(r: Reading, period: string): Figure {
upperfence: [q3],
marker: { color: '#4269C2' },
fillcolor: 'rgba(66,105,194,0.55)',
hovertemplate: `Q3: %{q3:${SHORT}}<br>Mediana: %{median:${SHORT}}<br>Q1: %{q1:${SHORT}}<extra></extra>`,
hoverinfo: 'skip',
} as Partial<Plotly.Data>,
{
type: 'scatter',
mode: 'markers',
x: [period],
y: [r.score!],
customdata: [[q3, r.score!, q1]],
marker: { size: 40, opacity: 0 },
hovertemplate: `Q3: %{customdata[0]:${SHORT}}<br>Mediana: %{customdata[1]:${SHORT}}<br>Q1: %{customdata[2]:${SHORT}}<extra></extra>`,
},
],
layout: {
showlegend: false,
+6 -1
View File
@@ -409,7 +409,12 @@ describe('TEA clinical figures', () => {
q1: [8],
median: [12.5],
q3: [20],
hovertemplate: 'Q3: %{q3:.1~f}<br>Mediana: %{median:.1~f}<br>Q1: %{q1:.1~f}<extra></extra>',
hoverinfo: 'skip',
});
expect(figure.data[1]).toMatchObject({
customdata: [[20, 12.5, 8]],
hovertemplate:
'Q3: %{customdata[0]:.1~f}<br>Mediana: %{customdata[1]:.1~f}<br>Q1: %{customdata[2]:.1~f}<extra></extra>',
});
});