Show tooltip on hovering anywhere in Y axis insted of column

528 Views Asked by At

Example Chart Image

I want to show tooltip for Approval Count as 0 on hovering anywhere in it's general vicinity, is that possible with highcharts?

1

There are 1 best solutions below

0
On

You can render this particular column as a dummy point - full range & transparent color to show a tooltip for it.

Highcharts.chart('container', {

  chart: {
    type: 'bar'
  },

  yAxis: {
    max: 10
  },

  tooltip: {
    formatter(tooltip) {
      if (this.point.isEmpty) {
        return 'Null';
      }
      return tooltip.defaultFormatter.call(this, tooltip);
    }
  },

  series: [{
    data: [{
      x: 0,
      y: 2
    }, {
      x: 1,
      y: 3
    }, {
      x: 2,
      y: 10,
      color: 'transparent',
      isEmpty: true
    }, {
      x: 3,
      y: 8
    }, {
      x: 4,
      y: 2
    }]
  }]
});

Demo: https://jsfiddle.net/BlackLabel/ef8sj4no/

API: https://api.highcharts.com/highcharts/tooltip.formatter