如何禁用Highcharts中的悬停颜色更改? [英] How to disable the on-hover color change in Highcharts?
问题描述
我使用我的项目的柱形图。我写了一个自定义函数,根据它的y值来对图表的每个条形进行颜色。这在我初始化图表工作正常。当我将鼠标悬停在图表上时,栏的颜色会恢复为默认值,我的自定义颜色不会返回。
I am using the column charts for my project. I have written a custom function that colors each bar of the chart based upon its y value. This works fine when I initialize the chart. As I hover over the chart, the color of the bar goes back to the default and my custom colors never return.
我试图禁用悬停,但似乎不工作。我不想让颜色改变,即使在盘旋在酒吧。任何建议?
I have tries disabling on hover but that doesn't seem to work. I don't want the color to change even when hovered over the bar. Any suggestions?
推荐答案
您以错误的方式更新颜色,使用 point.update / code>: http://jsfiddle.net/CaPG9/8/
You are updating color in a wrong way, use point.update()
instead: http://jsfiddle.net/CaPG9/8/
$('#container').highcharts({
chart: {
type: 'bar'
},
tooltip: {
valueSuffix: ' millions'
},
series: [{
name: 'Year 1800',
data: [107, 31, 635, 203, 2]
}]
},function(chart){
var max = 200;
$.each(chart.series[0].data,function(i,data){
if(data.y > max)
data.update({
color:'red'
});
});
});
这篇关于如何禁用Highcharts中的悬停颜色更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!