Chart.js: Tooltip not showing with tooltip mode "label" and datapoint value NULL on same x value in multi line chart.

Created on 10 May 2016  ·  9Comments  ·  Source: chartjs/Chart.js

Tooltip not showing on multi line chart with tooltip mode set to "label" when datapoint with value NULL exists at the same x value as the one I hover over.

I am hiding some lines with a custom made legend by looping through datasets and setting data points to NULL. This worked fine on charts.js version 1.0.2. The tooltip then showed the labels and values for the points that had data. In version 2.1.2 the tooltip does not show up at all if some of the lines has datapoints set to NULL on the same x value as the one hovered.

It workes as descibed when tooltip mode set to "single", but I would like to show all the values from multiple lines on the same x value (that are not NULL).

ps: when console logging "tooltipItems" in a tooltips.callbacks.label function, the yLabel for datapoints set to NULL is printed as NaN in the browser console.
pss: tested in Chrome Version 49.0.2623.112 m and IE 11.

Any tips on this would be very much appreciated. Thanks in advance:)

bug

Most helpful comment

Nice ;), it's my first pull request on github, hope to help again fixing some bugs. Great project btw @etimberg

All 9 comments

@emilz0r Can you please post a fiddle?

Thanks for your reply. Here is a fiddle:
https://jsfiddle.net/x3mqch2h/

This is copied off of the sample tooltip-hooks.html
The only change is that the third datapoint on the second dataset is set to NULL, instead of randomScalingFactor().
What happens is that when you hover over the point on the dotted line where the other line is cut, there is no tooltip. I would expect the tooltip to show data for the one line that has a value (the dotted one).

Info: Did the same thing, replacing randomScalingFactor() with null on the samples: bar.html and bar-stacked.html. In theese charts, the tooltip showes up, but it lists the null point with a value NaN. This could probably be set to what you want through a tooltip callback.

Don't know if this helps at all, but thought I'd share the observation anyway.

Have same problem with null values, it works on 2.0.2, but not on 2.1.2

+1

I tried to fix it: #2567

@adileo I saw that your commit was merged into chartjs:master. Does this mean that it the fix will be included in the next release (2.1.4), or is it already available? Sorry for asking basic github question.

I managed to fix my end, by using tooltip callbacks and a custom tooltip function, but would love to use a "native" fix.

It will be in the next release

Nice ;), it's my first pull request on github, hope to help again fixing some bugs. Great project btw @etimberg

Was this page helpful?
0 / 5 - 0 ratings