如何动态更改highchart的条形悬停颜色? [英] how to change bar hover color of highchart dynamically?
本文介绍了如何动态更改highchart的条形悬停颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码设置条形悬停颜色:
I set bar hover color using below code:
plotOptions: {column: {states: {hover: {color: '#000000'}}}}
但是如何动态更改条形悬停颜色?
But how can I change the bar hover color dynamically?
推荐答案
定义的颜色集,每次加载图表时,都会遇到与给定的颜色不同的悬停效果
Defined set of colors, when you load charts every time you will experience a different color of hover effect from the given set
var colors= ['#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9',
'#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'];
var x = Math.floor((Math.random() * 10) );
plotOptions: {
column: {
states: {
hover: {
color: colors[x]
}
}
}
},
还有小提琴链接以了解详情
为将来的持续工作,请单击按钮以触发图表重新加载
For future continual work, make a button to trigger chart reload
这篇关于如何动态更改highchart的条形悬停颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文