简体   繁体   中英

Highcharts yAxis labels click event

So couple weeks ago I asked a question on how to access the click event of HighCharts yAxis. I was greatly helped out but an example of using formatter:function(){somecode} . Initially this did work but I have multiple high charts on a page and for some odd reason it throws off the css of the highcharts plot options tooltip/overlay. I have researched the documentation and the chart itself has a event click that works but is there anything else that works on the yAxis?

I've just tried to access the tspan and add a click event listener just nothing is happening. Any other suggestions/help is greatly appreciated.

Thanks

You can use the custom_events plugin and add the event in this way:

yAxis: {
  labels: {
    events: {
      click: function() {
        ...
      }
    }
  }
}

Live demo: https://jsfiddle.net/BlackLabel/xnr7hqap/

Docs: https://blacklabel.github.io/custom_events/

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