John Smith
John Smith

Reputation: 1105

how to display both the series value in plotoptions mouseover event

Using tooltip formatter we can display both the series name and value but when same is done using the plotoptions event mouseover am not able to get the series name and value

Tooltip: formatter

PlotOption:Mousover

                            mouseOver: function () {
                            $.each(this, function (i, e) {
                            $reporting.html('x: ' + this.x + 'Category: ' + this.series.name + ', y: ' +Highcharts.numberFormat(Math.abs(this.y)));
                                });
                        } 

Upvotes: 1

Views: 1513

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Example of using it in mouseover

mouseOver: function () {
                            console.log(this);
                            var series = this.series.chart.series,
                                x = this.x,
                                y = this.y,
                                output = 'x: ' + x + 'y: ' + Highcharts.numberFormat(Math.abs(y));
                            //loop each serie
                            $.each(series, function (i, e) {

                                output += ' Category: ' + this.name;

                                if(i>0) {
                                    $.each(series[i].data,function(j,point){
                                        if(point.x === x) {
                                            output += ' y: ' + Highcharts.numberFormat(Math.abs(y));
                                        }

                                    });
                                }


                            });

                            $reporting.html(output);
                        }
                    }
                },

http://jsfiddle.net/ZrTux/77

Upvotes: 2

Related Questions