hofo
hofo

Reputation: 522

Extra data in point object isn't available for tooltip

In Highcharts, I've got my data set up like so:

var data = [{
    x: Date.UTC(2011, 10, 1),
    y: 1.9,
    variance: 2.6
}, {
    x: Date.UTC(2011, 11, 1),
    y: 2.0,
    variance: 2.6
}...];

I want to use the variance value in my tooltip. But the variance value doesn't show in the point object available to the tooltip formatter. What am I missing?

JSFiddle : http://jsfiddle.net/hofo/um7f6/17/

Upvotes: 1

Views: 1066

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Please take look at similar example http://jsfiddle.net/fbMQf/119/

    tooltip:{
    formatter:function(){
        return '<b>' + this.series.name + '</b>' + 
        '<br/><b>X Value:</b> ' + this.x +
        '<br/><b>Y Value:</b> ' + this.y +
        '<br/><b>Other Data:</b> ' + this.point.note;
    }
},

Upvotes: 1

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

Fix your formatter string to the following:

var tooltipString = "Highcharts.dateFormat('%b-%y', this.x) + ' survey<br>Average inflation expectations: ' + this.y + '<br>Variance ' + point.point.variance";

And then you should add this to your detailChart data.

Change detailData.push(point.y); to detailData.push(point.options);

Demo

Upvotes: 1

Related Questions