Limit range for display of tooltip on area chart with Highcharts

Asked

Viewed 134 times

1

I am making an area chart with Highcharts and I need the tooltip to be displayed only when I place the mouse cursor at the point of the series, and not on the line.

Does anyone know if there’s a way to do it?

My example: Here

Att

1 answer

1


I have been looking and I have not found a direct solution. Apparently this is not possible as an "option", but it can be done.

Reading these two answers on Soen [(1) (2)] can do this using series type: 'scatter'. Since this series cannot show the area, you need to have what you already have and add another line type: 'scatter' with the same data. You also need to join a function in the tootip options:

    tooltip: {
        shared: true,
        formatter: function () {
            if (this.points && this.points.length == 1) {
                return false;
            } else {
                var p = this;
                return 'x: ' + p.x + '<br/>y: ' + p.y;
            }
        }
    },

Example: jsFiddle

Browser other questions tagged

You are not signed in. Login or sign up in order to post.