prabh_singh
prabh_singh

Reputation: 177

Highchart tooltip position to be fixed

I HV multi line chart, I want the shared tooltip to be at the top of the graph ( so that it doesn't covers up the space of graph) , but I want it to have fixed 'y' And x coordinate to be Free. So that user can hover over the graph and the tooltip comes at the top of that point ( x coordinate).

Is there a way where I can fix only the y coordinate of the tooltip position?

Upvotes: 2

Views: 2106

Answers (1)

Barbara Laird
Barbara Laird

Reputation: 12717

You can use the tooltip.positioner function. http://api.highcharts.com/highcharts/tooltip.positioner

tooltip: {
    positioner: function (labelWidth, labelHeight, point) {
        return { x: point.plotX, y: 15 };
    },
    shadow: false,
    borderWidth: 0,
    backgroundColor: 'rgba(255,255,255,0.8)'
},

http://jsfiddle.net/nt9x5tjj/

The callback receives a point object that contains plotX and plotY positions. Fix the y value to some number and return point.plotX as the x value.

Upvotes: 6

Related Questions