高图yAxis单击事件 [英] Highcharts yAxis click event

查看:59
本文介绍了高图yAxis单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用图表来渲染一些数据.在yAxis上,我需要将这些值用作定位标记并导航至侧面模态.通过使用标签对象的格式化程序功能,可以使其正常工作.我现在想做的是我要禁用单击事件的表的第一个单元格,这样它就不会将用户带到仅显示其旁边的模式.

I am using highcharts to render some data. On the yAxis I needed those values to be anchor tags and navigate to a side modal. Was able to get that working correctly by using the formatter function of the labels object. What I am trying to do now is the first cell of the table I want to disable the click events so it does not take the user to the side modal its display only.

labels{
 align: 'left',
 formatter: function(){
  return `<a href=javascript:openModal() ${this.value}  </a>`
 }
}

我尝试用jquery定位第一个表格单元格,例如

I've tried with jquery targeting the first table cell like

$('tspan.highcharts-anchor:first').unbind();

任何建议都将不胜感激谢谢

Any suggestions are greatly appreciated Thank you

推荐答案

根据注释-有一段代码禁止在第一个yAxis.label上打开模态.

According to the comments - there is a code which disables opening the modal on the first yAxis.label.

演示: https://jsfiddle.net/BlackLabel/25c38ez4/

  yAxis: {
    labels: {
      formatter: function() {
        console.log(this)
        if (this.isFirst) {
          return this.value
        } else {
          return `<a href=javascript:openModal()> ${this.value} </a>`
        }

      }
    }
  }

这篇关于高图yAxis单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆