简体   繁体   中英

Show tooltip on hovering anywhere in Y axis insted of column

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM