Disable marker hover in only one marker of highchart

柔情痞子 提交于 2020-01-22 19:46:30

问题


I am trying to convince my highchart to do my bidding and have encountered a problem.

What I want to acchieve: I want one of the markers of the graph to disappear. I want the line to go through (and break at) one point, but the point is completely irrelevant and I do not want that point to pop up when hovering over it. My current code looks something like this:

$(function () {
var chart;
$(document).ready(function() {
    chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            type: 'line'
        },   
        plotOptions: {
            series: {
                states: {
                    hover: {
                        enabled: true
                    }
                }
            }
        },
        series: [{
            marker: {
                enabled: false
            },
            data: [15.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, {
                y: 26.5,
                marker: {
                    enabled: false,
                    states: {
                        hover: {
                            enabled: false
                        }
                    }
                }
            }, 23.3, 18.3, 13.9, 9.6]    
        }]
    });
});
});

And all my markers behave the same: they are not visible until I hover over them, at which point they pop up. What I want is for all my markers to behave as they do in the provided code, with the exception of the marker at y=25.6. I want the behaviour of this marker be the same as the behavior I get from all markers when i set

hover:{ enabled: false }

in my original code. That is, I want the marker to "dissapear" completely.

Thanks in advance for all your help. Jan


回答1:


This is unfortunately bug in Highcharts, see this.




回答2:


Try this in your series: enableMouseTracking: false

In your case, it would be:

series: [{ 
    data: [15.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, {
        enableMouseTracking: false,
        y: 26.5
    }, 23.3, 18.3, 13.9, 9.6]    
}]

I hope this helps!

(Update on 6/23/17): For those who want to apply this to every series in the chart, not just one, you would do the following:

plotOptions: {
    series: { enableMouseTracking: false }
}


来源:https://stackoverflow.com/questions/17742507/disable-marker-hover-in-only-one-marker-of-highchart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!