nivo
nivo copied to clipboard
Incorrect tooltip content when using <ResponsiveLineCanvas />
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:
- Go to the sandbox example using
<ResponsiveLineCanvas/>
: https://codesandbox.io/s/nivo-line-time-y-axis-forked-7uvix?file=/src/index.js - Hover your mouse at about the start of the green part of the line (see the Image -1 in the Screenshots section below)
- The tooltip that comes up has wrong
x
andy
axis values. - Now go to the sandbox example using
<ResponsiveLine/>
: https://codesandbox.io/s/ancient-pond-hkvhr?file=/src/index.js - Hover you mouse again almost at the start of the green part of the line (see the Image -2 in the Screenshots section below)
- The tooltip shows the correct
x
andy
values.
Expected behavior
The tooltips should show correct information when using <ResponsiveLineCanvas/>
.
Screenshots
Image-1 <ResponsiveLineCanvas/>
with incorrect tooltip
Image-2 <ResponsiveLine/>
with correct tooltip
Desktop (please complete the following information):
- Windows 10
- Chrome Version 92.0.4515.107
- "@nivo/core": "0.72.0",
- "@nivo/line": "0.72.0",
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
@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.