Description
The chart widget currently has hovermode hardcoded to 'x unified' in the toPlotly function (WidgetChart.jsx).
This causes Plotly to always display the X axis value (absolute time) as the header of the unified tooltip,
regardless of what is defined in the hovertemplate of each trace.
Additionally, PR #12413 introduced a workaround (hoverOnlyOnTickValues / handleBeforeHover /
getHoverOnlyOnTickValuesAxisOptions) to limit tooltip visibility to tick positions only.
This workaround does not match the original requirement and should be removed as part of this fix.
Requirement
The original needing was:
"An option to allow configuring the chart tooltip to exclude the X axis label,
so users can see the Y value without the absolute time indication."
Proposed Fix
1. Remove the tick-based tooltip workaround from #12413
Remove the following logic from WidgetChart.jsx:
getHoverOnlyOnTickValuesAxisOptions
getHoverAxis / getHoverPixel / isHoverOnAxisTickValues / isHoverOnTickValues
hoverOnlyOnTickValuesAxisOptions memo
handleBeforeHover callback and its onBeforeHover prop
Also remove the related configuration option (showHoverOnlyOnTickValues) from the axis options
and from the widget creation wizard.
2. Make hovermode configurable in the Layout tab
Add a new dropdown option in the Layout tab of the widget creation wizard to control the chart hovermode.
The available options should be:
- Unified X tooltip (
x unified) — shows a single tooltip for all traces at the same x position, including the x axis value as header. (default)
- Unified Y tooltip (
y unified) — shows a single tooltip for all traces at the same y position, including the y axis value as header.
- X tooltip (
x) — shows individual tooltips for all traces at the same x position, including the x axis value.
- Y tooltip (
y) — shows individual tooltips for all traces at the same y position, including the y axis value.
- Individual tooltip (
closest) — shows a tooltip only for the closest data point, without the axis value.
- No tooltip (
false) — disables the tooltip entirely.
Describe the mode in a tooltip.
Acceptance Criteria
Description
The chart widget currently has
hovermodehardcoded to'x unified'in thetoPlotlyfunction (WidgetChart.jsx).This causes Plotly to always display the X axis value (absolute time) as the header of the unified tooltip,
regardless of what is defined in the
hovertemplateof each trace.Additionally, PR #12413 introduced a workaround (
hoverOnlyOnTickValues/handleBeforeHover/getHoverOnlyOnTickValuesAxisOptions) to limit tooltip visibility to tick positions only.This workaround does not match the original requirement and should be removed as part of this fix.
Requirement
The original needing was:
Proposed Fix
1. Remove the tick-based tooltip workaround from #12413
Remove the following logic from
WidgetChart.jsx:getHoverOnlyOnTickValuesAxisOptionsgetHoverAxis/getHoverPixel/isHoverOnAxisTickValues/isHoverOnTickValueshoverOnlyOnTickValuesAxisOptionsmemohandleBeforeHovercallback and itsonBeforeHoverpropAlso remove the related configuration option (
showHoverOnlyOnTickValues) from the axis optionsand from the widget creation wizard.
2. Make
hovermodeconfigurable in the Layout tabAdd a new dropdown option in the Layout tab of the widget creation wizard to control the chart
hovermode.The available options should be:
x unified) — shows a single tooltip for all traces at the same x position, including the x axis value as header. (default)y unified) — shows a single tooltip for all traces at the same y position, including the y axis value as header.x) — shows individual tooltips for all traces at the same x position, including the x axis value.y) — shows individual tooltips for all traces at the same y position, including the y axis value.closest) — shows a tooltip only for the closest data point, without the axis value.false) — disables the tooltip entirely.Describe the mode in a tooltip.
Acceptance Criteria
hovermodex unified(default),y unified,x,y,closest,falsehovermodeis correctly passed to the Plotly layout:hovermode: layout?.hovermode ?? 'x unified'closestis selected, only the Y value is shown in the tooltip (no absolute time), consistently across all trace types and screen sizesfalseis selected, no tooltip is shown