score:7

Accepted answer

you need to set the event on the plotoptions property. here's an example taken from the highcharts api documentation:

$(function () {
    var $reporting = $('#reporting');

    $('#container').highcharts({

        title: {
            text: 'mouse events demo'
        },
        subtitle: {
            text: 'on point mouse over or mouse out, the values should be reported in top left'
        },
        plotoptions: {
            series: {
                point: {
                    events: {
                        mouseover: function () {
                            var chart = this.series.chart;
                            if (!chart.lbl) {
                                chart.lbl = chart.renderer.label('')
                                    .attr({
                                        padding: 10,
                                        r: 10,
                                        fill: highcharts.getoptions().colors[1]
                                    })
                                    .css({
                                        color: '#ffffff'
                                    })
                                    .add();
                            }
                            chart.lbl
                                .show()
                                .attr({ 
                                    text: 'x: ' + this.x + ', y: ' + this.y 
                                });
                        }
                    }
                },
                events: {
                    mouseout: function () {
                        if (this.chart.lbl) {
                            this.chart.lbl.hide();
                        }
                    }
                }
            }
        },

        tooltip: {
            enabled: false
        },

        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
});

demo

score:1

you can also use chart.hoverpoint if trying to find out the currently moused over point from outside the mouseover event. however this is not on the documentation, which likely means it can change in the future.


Related Query

More Query from same tag