1

I have the same problem posted in the post : highcharts pass multiple values to tooltip

I want to pass data to tooltip but this.point.config[2] is not working. Also I found this example. It's not working there too

    formatter: function() {
    return 'param1: '+this.point.config[2] + 'param2: '+this.point.config[3];

can you please help me

Community
  • 1
  • 1
dxtr
  • 685
  • 1
  • 7
  • 16

1 Answers1

4

If you want to pass in extra values into the tool tip, the data series needs to be list of objects rather than list of values:

data: [
    {
        x: 7, 
        y: 10, 
        config1: 'test',     // our custom data
        config2: 'test2'     // our custom data
    }, 
    {
        x:10, 
        y:20, 
        config1: 'test3',    // our custom data
        config2: 'test4'     // our custom data
    }
]

So in your Highcharts formatter function you can reference the custom parameters eg. config1 and config2 (you can use whatever name you want really) :

tooltip: {
    formatter: function() {
        return 'param1: '+this.point.config1 + '<br/>param2: '+this.point.config2;
    }
}

See fiddle: http://jsfiddle.net/FuyTC/8/

Amy
  • 7,388
  • 2
  • 20
  • 31