Skip to content

Wrong hover effect with minInterval === 1Β #2757

@markov00

Description

@markov00

Describe the issue
Rendering a chart with a minInterval of 1ms creates an issue in the tooltip: the tooltip jumps to the closest bar when you are with your mouse 1 bar before the actual highlighted bar.

This is caused by the check here where the difference computed between the currentValue and the inverted value is exactly 1 as the min interval. I'm not sure if this is even visible with other values.

const withinBandwidth = invertedValue - currentValue <= this.minInterval;
where

To Reproduce
Steps to reproduce the behavior:

  1. Go to the storybook, and create a chart with the following config:
<Settings
        debug={boolean('debug', false)}
        baseTheme={useBaseTheme()}
        xDomain={{
          min: new Date('2025-10-27T14:32:00.622Z').valueOf(),
          max: new Date('2025-10-27T14:32:00.650Z').valueOf(),
          minInterval: 1,
        }}
      />
      <Axis
        id="bottom"
        position={Position.Bottom}
        title="Bottom axis"
        showOverlappingTicks={boolean('showOverlappingTicks bottom axis', false)}
        showOverlappingLabels={boolean('showOverlappingLabels bottom axis', false)}
        tickFormat={formatter}
      />
      <Axis id="left2" title="Left axis" position={Position.Left} tickFormat={(d: any) => Number(d).toFixed(2)} />

      <BarSeries
        id="bars"
        xScaleType={ScaleType.Time}
        yScaleType={ScaleType.Linear}
        xAccessor="key"
        yAccessors={['doc_count']}
        data={[
          {
            key_as_string: '2025-10-27T15:32:00.630+01:00',
            key: 1761575520630,
            doc_count: 23,
          },
          {
            key_as_string: '2025-10-27T15:32:00.632+01:00',
            key: 1761575520632,
            doc_count: 1,
          },
          {
            key_as_string: '2025-10-27T15:32:00.637+01:00',
            key: 1761575520637,
            doc_count: 1,
          },
        ]}
      />
  1. Move your mouse over the cahrt

Expected behaviour
There should be no jump between highlighted intervals.

Screenshots

Image

Version (please complete the following information):

  • Elastic Charts: main

Metadata

Metadata

Assignees

No one assigned

    Labels

    :dataData/series/scales related issue:tooltipRelated to hover tooltip:xyBar/Line/Area chart relatedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions