简体   繁体   中英

Disable marker hover in only one marker of highchart

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

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 }
}

不幸的是,这是Highcharts中的错误,请看这个

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM