nivo icon indicating copy to clipboard operation
nivo copied to clipboard

Incorrect tooltip content when using <ResponsiveLineCanvas />

Open anam-dodhy opened this issue 2 years ago • 2 comments

Describe/explain the bug The tooltips show incorrect x and y axis values when using the canvas based Nivo/line component <ResponsiveLineCanvas/> whereas they worked correctly when using the SVG based component <ResponsiveLine />.

To Reproduce Sandbox example using <ResponsiveLineCanvas/> component where the tooltips are incorrect https://codesandbox.io/s/nivo-line-time-y-axis-forked-7uvix?file=/src/index.js

Sandbox example using <ResponsiveLine/> component where the tooltips are correct https://codesandbox.io/s/ancient-pond-hkvhr?file=/src/index.js

Both sandbox examples are exactly the same except for the part where the first one is using <ResponsiveLineCanvas/> and the second one is using <ResponsiveLine/>.

Steps to reproduce the behavior:

  1. Go to the sandbox example using <ResponsiveLineCanvas/>: https://codesandbox.io/s/nivo-line-time-y-axis-forked-7uvix?file=/src/index.js
  2. Hover your mouse at about the start of the green part of the line (see the Image -1 in the Screenshots section below)
  3. The tooltip that comes up has wrong x and y axis values.
  4. Now go to the sandbox example using <ResponsiveLine/>: https://codesandbox.io/s/ancient-pond-hkvhr?file=/src/index.js
  5. Hover you mouse again almost at the start of the green part of the line (see the Image -2 in the Screenshots section below)
  6. The tooltip shows the correct x and y values.

Expected behavior The tooltips should show correct information when using <ResponsiveLineCanvas/>.

Screenshots Image-1 <ResponsiveLineCanvas/> with incorrect tooltip image

Image-2 <ResponsiveLine/> with correct tooltip image

Desktop (please complete the following information):

  • Windows 10
  • Chrome Version 92.0.4515.107
  • "@nivo/core": "0.72.0",
  • "@nivo/line": "0.72.0",

anam-dodhy avatar Aug 25 '21 12:08 anam-dodhy

I thought that <ResponsiveLine /> had a similar issue, however I just figured out how stacked functionality behaves. So tooltip in that case is indeed correct

molinch avatar May 02 '22 10:05 molinch

@anam-dodhy, the underlying Voronoi mesh used to capture events for the canvas version doesn't work well with a single line and collinear points unfortunately, you can see it by enabling debugMesh={true}, I don't have a solution for this at the moment.

plouc avatar May 10 '22 13:05 plouc