Skip to content

Replace "show only tick values" with hide value in tooltip" option #12439

@offtherailz

Description

@offtherailz

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.

Image

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

  • A new dropdown in the Layout tab allows the user to select the chart hovermode
  • The following options are available: x unified (default), y unified, x, y, closest, false
  • The selected hovermode is correctly passed to the Plotly layout:
    hovermode: layout?.hovermode ?? 'x unified'
  • When closest is selected, only the Y value is shown in the tooltip (no absolute time), consistently across all trace types and screen sizes
  • When false is selected, no tooltip is shown
  • The setting is correctly persisted in and restored from the widget configuration

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions