Highcharts:如何在区域图中的MouseOver事件中更改除了悬停的区域之外的所有区域的颜色

时间:2015-05-28 09:22:02

标签: highcharts hover mouseover

如何在区域图中的MouseOver事件中更改除了悬停的区域之外的所有区域的颜色?

这不起作用

var colors_grey = ["#eeeeee", "#e3e3e3","#e5e5e5", "#e6e6e6","#ededed", "#ececec"];

...

mouseOver: function () {
   var serie = this.chart.series;
   $.each(serie, function (i, e) {
        this.graph.attr({
            fill:  colors_grey[i],
            fillColor: colors_grey[i],
            stroke:  colors_grey[i]
        });
    });

    this.graph.attr({
        fillColor:  this.color
    });
}

我如何在标记内部使用dataLabel?

http://jsfiddle.net/cms5Lrdv/12/(图片应该如何 - 内部)

提前致谢

1 个答案:

答案 0 :(得分:2)

使用this.area而不是this.graph,请参阅:http://jsfiddle.net/cms5Lrdv/23/

                mouseOver: function () {
                   var self = this,
                       serie = this.chart.series;
                   $.each(serie, function (i, e) {
                       if(this != self) {
                           this.area.attr({
                               fill:  colors_grey[i],
                               fillColor: "#ff0000",
                               stroke:  "#ff0000",
                           });
                       } else {
                           this.area.attr({
                               fill:  "orange",
                               fillColor: "#ff0000",
                               stroke:  "#ff0000",
                           });   
                       }
                    });

                },