停止HighCharts增加悬停线的宽度

Joh*_*ith 5 html javascript css jquery highcharts

我正在使用最新版本的HighCharts来构建具有多种趋势的图表.默认情况下,当用户的鼠标悬停在线上时,HighCharts会增加线条的粗细/线宽.因为我可以在图表上有~10个趋势,我想删除此功能,这意味着线条的粗细在悬停时不会改变.

到目前为止jsFiddle的代码

我相信我需要在plotOptions {}部分设置它.我尝试添加以下内容但没有成功:

plotOptions: {
    series: {
        mouseOver: {
            lineWidth: 2
        }
    },
    marker: {
        enabled: false,
        states: {
            hover: {
                lineWidth: 2
            }
        }
    }
},
Run Code Online (Sandbox Code Playgroud)

但是,我想保留表示鼠标定位位置的标记:

在此输入图像描述

Sow*_*mya 12

进行以下更改(将states鼠标悬停设置为禁用状态)

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        enabled: false
                    }
                }
            },
Run Code Online (Sandbox Code Playgroud)

DEMO


在这种情况下,make lineWidth:1表示悬停

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        lineWidth: 1
                    }
                }
Run Code Online (Sandbox Code Playgroud)

演示2

  • 请参阅下面的答案.这种类型的设置需要用更新的属性lineWidthPlus替换.使您的设置更加简化. (2认同)

jlb*_*ggs 6

您需要的是lineWidthPlus酒店.

plotOptions: {
  series: {
    states: {
      hover: {
        lineWidthPlus: 0
     }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

这样,无论你改变什么,图表都不会在悬停时改变lineWidth.

API参考:

你的小提琴更新: