javascript - Highcharts:悬停散点图系列时如何更改线条颜色

标签 javascript highcharts scatter-plot

我有一个 Highcharts 散点图。图表对象的一些细节如下:

plotOptions: {
scatter: {
    lineWidth:1,
    marker: {
        radius: 1,
        symbol:'circle',
        fillColor: '#800000',
        states: {
            hover: {
                enabled: true,
                radius:0,
                radiusPlus:2,
                lineColor: '#ff0000',
                fillColor: '#ff0000'
            }
        }
    },
    states: {
        hover: {
            halo:false,
            lineWidthPlus:2,
        }
    }
}
}

完整的工作示例是here . 将系列悬停时,我需要更改线条颜色,但我做不到。这可能吗?

最佳答案

这可以通过事件轻松实现。

您只需要在用户将鼠标悬停在系列上时更新系列颜色属性

events: {
    mouseOver: function () {

        this.chart.series[this.index].update({
             color: 'red'
        });
    },
    mouseOut: function () {

        this.chart.series[this.index].update({
            color: "#b0b0b0"
        });                           
     }
 }

这将更改悬停点的系列的颜色。

here is update to your fiddle

希望对您有所帮助。

关于javascript - Highcharts:悬停散点图系列时如何更改线条颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34575870/

相关文章:

javascript - 链接附加标题本地存储

javascript - Jquery:无法让动画工作

javascript - Highcharts y 轴单位位于顶部

r - 点太多的散点图

由于格式值错误,excel散点图不正确

javascript - 防止过渡变换比例上的边界模糊

javascript - 从通过 React Router 设置的路由访问 Redux Store

javascript - Highcharts 系列不显示数据和渲染图表

javascript - Highstock.js : Not able to create multi pane chart with two stacked column charts, 一个 "normal"另一个 "percent"

python - 如何将固定颜色条添加到 3D 散点动画图并相应地对点进行颜色映射?