Would it be possible to display a tooltip based on closest line on the x-axis

Hi again,

When displaying a line chart with a lot of data (30+ values) it becomes really awkward to hover over a point and display the tooltip without getting the mouse really close to it, even with the hit radius increased as it gets to the point where the hit radius of multiple points cross over. Would it be possible to have a hover option that will display the tooltip depending on what point you’re closest in regards to the x-axis? By this I mean if you had a line chart with 10 points on the x-axis and your mouse is on the chart halfway between the x-axis and the line of data, it will display the tooltip and activate the hover for the point on the linechart that corresponds to how far along the x-axis you are.

Sorry if it isn’t clear, it’s quite difficult to explain. If you need me to try and clarify feel free to ask.

Thanks

Author: Fantashit

3 thoughts on “Would it be possible to display a tooltip based on closest line on the x-axis

  1. For anybody getting here, since 2.4.0, you may simply set your tooltip configuration (options.tooltips or Chart.defaults.global.tooltips) with the following options:

    {
      mode: 'index',
      intersect: false
    }
    

    You may set the same options to the hover configuration (options.hover or Chart.defaults.global.hover) so that your points are rendered at the same time as the tooltips.

    More info in the documentation.

  2. screen shot 2017-11-17 at 14 01 03

    @JelleBlaauw yep, I have the same problem. My datasets have different starting dates and like in the picture when I hover the gray line, it will it will hilight the orange line on the “wrong” index (red arrow). I would like it to show the value from the same date (green arrow). Is this missing feature or am I doing something wrong here?

Comments are closed.