本文介绍了* Highchart *禁用图例项单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个饼图,并且想要禁用该选项,当我们单击图例时隐藏系列.我使用:

I have a pie chart and want to disable the option hide the series when we click to the legend. I use:

events: {
                legendItemClick: function () {
                  return false
                }
              }

但是它似乎不起作用.我该怎么办?

but it seems not working. How can I do that ?

这是我的jsFiddle: http://jsfiddle.net/9pj3kxr6/

Here is my jsFiddle: http://jsfiddle.net/9pj3kxr6/

推荐答案

对于饼图,每个图例项均与点/切片相连,因此应在point.events级别上设置此事件:

For pie chart, each legend item is connected to the point/slice, so this event should be set on point.events level:

  plotOptions: {
    pie: {
      allowPointSelect: true,
      cursor: 'pointer',
      dataLabels: {
        enabled: false
      },
      showInLegend: true,
      point: {
        events: {
          legendItemClick: function() {
            return false;
          }
        }
      }
    }
  },

请参阅演示: http://jsfiddle.net/9pj3kxr6/1/

这篇关于* Highchart *禁用图例项单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:32