停止高图增加线的宽度在悬停

时间:2022-11-05 13:53:27

I am using the latest version of HighCharts to build a chart with multiple trends. By default HighCharts increases the thickness / lineWidth of a line when the user's mouse hovers over it. Because I could have ~10 trends on the chart I would like to remove this feature, meaning that the thickness of the line does not change on hover.

我正在使用最新版本的HighCharts构建一个具有多种趋势的图表。默认情况下,当用户的鼠标悬停在一条线上时,它会增加线的厚度/线宽。因为我可能在图表上有大约10个趋势,所以我想删除这个特性,这意味着线的厚度在悬停时不会改变。

jsFiddle of code so far

到目前为止的代码

I believe I need to set this in the plotOptions{} section. I have tried adding the following without success:

我认为我需要在plotOptions{}部分中设置这个。我尝试添加以下内容,但没有成功:

plotOptions: {
    series: {
        mouseOver: {
            lineWidth: 2
        }
    },
    marker: {
        enabled: false,
        states: {
            hover: {
                lineWidth: 2
            }
        }
    }
},

I would, however, like to retain the marker that denotes where the mouse of positioned:

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

停止高图增加线的宽度在悬停

2 个解决方案

#1


7  

Make this below change (Set the states mouseover to disabled state)

更改以下内容(将state mouseover设置为禁用状态)

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        enabled: false
                    }
                }
            },

DEMO

演示


In that case make lineWidth: 1 for hover

在这种情况下,将线宽设置为1表示悬停

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        lineWidth: 1
                    }
                }

DEMO 2

演示2

#2


6  

What you need here is the lineWidthPlus property.

这里需要的是lineWidthPlus属性。

plotOptions: {
  series: {
    states: {
      hover: {
        lineWidthPlus: 0
     }
    }
  }
}

This way, no matter what else you change, the chart will not change the lineWidth when hovered.

这样,不管您还更改了什么内容,该图表在悬停时都不会更改线宽。

API Reference:

API参考:

Your fiddle updated:

你的小提琴更新:

#1


7  

Make this below change (Set the states mouseover to disabled state)

更改以下内容(将state mouseover设置为禁用状态)

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        enabled: false
                    }
                }
            },

DEMO

演示


In that case make lineWidth: 1 for hover

在这种情况下,将线宽设置为1表示悬停

plotOptions: {
            series: {
                    lineWidth: 2,
                 states: {
                    hover: {
                        lineWidth: 1
                    }
                }

DEMO 2

演示2

#2


6  

What you need here is the lineWidthPlus property.

这里需要的是lineWidthPlus属性。

plotOptions: {
  series: {
    states: {
      hover: {
        lineWidthPlus: 0
     }
    }
  }
}

This way, no matter what else you change, the chart will not change the lineWidth when hovered.

这样,不管您还更改了什么内容,该图表在悬停时都不会更改线宽。

API Reference:

API参考:

Your fiddle updated:

你的小提琴更新: