Highcharts - 如何以编程方式更改线宽并防止重新设置线宽? [英] Highcharts -- how to change line width programmatically and prevent resetting line width?

查看:147
本文介绍了Highcharts - 如何以编程方式更改线宽并防止重新设置线宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个折线图,并添加了一个按钮,其click方法使线条变粗(lineWidth 7pt)。但是,每当我将鼠标放在线条或图例上时,线条都会恢复到其原始宽度(我相信它是2磅)。因此,我添加了以下图表选项来禁用悬停功能:

 行:{
states:{
盘旋:{
启用:false,
}
}
},

但它只能部分解决问题 - 在我使用按钮将lineWidth设置为7磅后,将鼠标移到图例或移动鼠标后,线宽仍将重置为原来的2 pt在绘图区域。



我已经在我的这里分享了我的示例。任何人都可以帮助我弄清楚如何在改变宽度为7磅后重置线宽?

$ b

Alex。

解决方案

您可以使用

  series.update({
lineWidth:10
});

http://jsfiddle.net/QNPYP/2/



http://api.highcharts.com/highcharts#Series.update()


I created a line chart, and added a button whose click method make the line thicker (lineWidth 7pt). However, each time I mouse over the line or the legend, the line restore to its original width (which I believe is 2 pt). So I added the following plot options to disable the "hover" function:

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

But it only resolves the issue partially -- after I set lineWidth to 7 pt using the button, the line width will still be reset to its original 2 pt after I mouse over the legend or move mouse across the plotting area.

I have shared my example here. Can anyone help me figure out how to prevent resetting the line width after changing its width to 7 pt?

Thanks in advance!

Alex.

解决方案

You can use

 series.update({
            lineWidth:10
        });

http://jsfiddle.net/QNPYP/2/

http://api.highcharts.com/highcharts#Series.update()

这篇关于Highcharts - 如何以编程方式更改线宽并防止重新设置线宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆