manisankar
manisankar

Reputation: 41

What is the solution for Highcharts hover

I draw an area chart using highchart jquery plug-in. 3 arrays needs to be passed to draw chart through AJAX call. 1st array data for x-axis. 2nd array data for Y-axis.3rd array has string value which needs to be passed into hover(max) along with y-axis value. Each array has 90 values. is it possible to show third array into hover? Could you please any one help me out?

$('#divcontainer').highcharts({

        chart: {

            type: 'area'
        },
        credits: {
  enabled: false },plotOptions: {
         area: {
            events: {
                legendItemClick: function () {

                    return false; // <== returning false will cancel the default action
                }
            }
        ,
        showInLegend: true
    }
}, title: {
        text: 'Chart',
        x: -20 //center
    },
    subtitle: {
        text: '',
        x: -20
    },
    xAxis: {
          labels:{rotation: rot, x:-20},
           categories: data[0]

      },
    yAxis: {
        title: {
            text: 'Status'
        },
        plotLines: [{
            value:0,
            width: 1,
            color: '#808080'
        }]
    },
    tooltip:{
         enabled: true,
         formatter: function() {
                    return '<b>' + this.x + '</b><br/><b>' + 'Status: ' + this.y + '</b>';}},

series: [{
        name: 'Status',
        data: data[1]
        }]
}); 

data[0] is 1st array, data[1] is 2nd array, and data[2] is 3rd array. These are the arrays from the ajax call.

Upvotes: 0

Views: 91

Answers (1)

alacy
alacy

Reputation: 5074

Perhaps you could try something like:

tooltip:{
         enabled: true,
         formatter: function() {
                    return '<b>' + this.x + '</b><br/><b>' + 'Status: ' + this.y + '</b>' + data[2][this.series.data.indexOf( this.point )];
         }
},

Notice the part with data[2][this.series.data.indexOf( this.point )].

Upvotes: 1

Related Questions