简体   繁体   English

Highcharts - 如何在鼠标悬停/悬停时禁用颜色更改

[英]Highcharts - how to disable color change on mouseover/hover

I have a Highcharts columnrange chart for which I'd like to disable the color change on mouseover or hover. 我有一个Highcharts列表范围图表,我想在鼠标悬停或悬停时禁用颜色更改。

I've seen others ask similar questions, and I tried to adding this section of code (which didn't fix the problem): 我见过其他人提出类似的问题,我试图添加这部分代码(没有解决问题):

    series: {
        states: {
            hover: {
                enabled: false
            }
        }
    },

Here's the chart's entire code: http://jsfiddle.net/x7uz7puv/2/ 这是图表的完整代码: http//jsfiddle.net/x7uz7puv/2/

Thanks in advance for your help. 在此先感谢您的帮助。

Add that code to the series object you already have. 将该代码添加到您已有的series对象中。

series: [{
  type: 'columnrange',
  color: '#00FFFF',
  name: '25th to 75th percentile',
  states: { hover: { enabled: false } }, // Here is where it goes
  data: [
    [27000, 55100],
    [25900, 58500]
  ]
},

Right now you have that code at the top level of your config object, where it doesn't work. 现在,您在配置对象的顶层有代码,但它不起作用。 The series object is an array of the chart series, so even if setting the option worked in that manner, it would be overwritten by your actual series object. series对象是图表系列的数组,因此即使设置选项以这种方式工作,它也会被实际的series对象覆盖。

It needs to either be set on the individual series level, as Stephen answered, or more globally, under the plotOptions . 它需要在单个系列级别上设置,如Stephen回答,或者更多全局,在plotOptions

By applying it to the individual series, you will need to repeat the code for every series you have. 通过将其应用于单个系列,您需要为每个系列重复代码。

By putting it in the plotOptions , with the series designation, you only need to specify it once, no matter how many series you have. 通过将它放在plotOptions ,使用series名称,无论你有多少系列,你只需要指定一次。

plotOptions: {
  series: {
    states: {
      hover: {
        enabled: false
      }
    }
  }
} 

Or, if you wanted it to apply to only certain series types, you could add it to only the series type you want it to apply to: 或者,如果您希望它仅应用于某些系列类型,则只能将其添加到您希望它应用于的系列类型:

plotOptions: {
  columnrange: {
    states: {
      hover: {
        enabled: false
      }
    }
  }
} 

Updated fiddle: 更新小提琴:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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