2

I have a question of adding extra tooltip info in Highchart.

My current highchart tooltip only displays [1,2] and [4,5] but in my data set I have third value besides x and y which are 3 and 6.

[[1,2,3],[4,5,6],...]

I want to add 3 and 6 into my tootip. What should I do next? enter image description here

Qing Xu
  • 175
  • 1
  • 11
  • I would recommend you post the JavaScript for your Highcharts configuration - it will make it easier to recommend a solution. – nb1987 May 01 '17 at 03:04

1 Answers1

2

You can use the tooltip.formatter property to customize the tooltip content. For example:

tooltip: {
        formatter: function () {
            return 'The value for <b>' + this.x +
                '</b> is <b>' + this.y + '</b> and the value for z is ' + this.point.z;
        }
    },

And since I'm referencing point.z in the callback function, my series's data array should also identify a z property:

series: [{
        data: [{y:29.9,z:'test 1'}, {y:71.5,z:'test 2'}, {y:106.4,z:'test 3'}]
    }]

Of course, you do not need to name your property z - you can name it whatever you want.

I have created a fiddle demonstrating the implementation: http://jsfiddle.net/cn9z1be5/1/

nb1987
  • 1,400
  • 1
  • 11
  • 12