0

I am able to configure the line chart tooltip when I hover over the datapoint. However, I would also like to show some data if hover is over the line segment between two data points. Code I am using is as follows :

callbacks: {
                  label: function (context) {
                    var value = labels[context.dataIndex];
                    for (var i = 0; i < flares.length; i++) {
                      // console.log(labels[ctx.p0DataIndex], flares[i]);
                      if (
                        value >= flares[i].Starttime &&
                        value <= flares[i].Endtime
                      ) {
                        return "Peak-Score : " + flares[i].PeakScore;
                      }
                    }

                    return "No flares";
                  },
                },
'''
hardik
  • 23
  • 4
  • Try to change the `options.plugins.tooltip.mode` and retain the one that best suits your needs: https://www.chartjs.org/docs/latest/configuration/interactions.html#modes – uminder Mar 12 '22 at 10:34
  • Sorry but this does-not work. I would like to show the tooltip when my cursor is at a line segment between the datapoints. Can you suggest a mode for it ? – hardik Mar 12 '22 at 10:45

0 Answers0