HighCharts自定义事件插件右键单击事件不发射



http://jsfiddle.net/ovbpacrt/1/

我无法获得contextmenu事件以右键单击上面的触发。

chart = new Highcharts.Chart(
{
   series:[
      {
         "data": data,
          type: 'pie',
          animation: false,
          point:{
              events:{
                  contextmenu: function (event) {
                      alert(this.id);
                  }
              }
          }          
      }
   ],
   "chart":{
      "renderTo":"container"
   },
});

如果我将contextmenu更改为click(而左键单击),则该事件正常工作。

问题的原因可能是什么?

您不能使用RAW GITHUB文件,因为它们会被CORS阻止。

 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://raw.githubusercontent.com/blacklabel/custom_events/master/js/customEvents.js with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details.

尝试使用CDN https://cdn.jsdelivr.net/npm/highcharts-custom-events@2.2.4/js/customevents.min.js

在这里,您可以在没有cdn https://gist.github.com/jesperorb/6CA596217C8DFBA23774966C2B5AB1E

的情况下了解更多信息。

最新更新