如何在plotoptions鼠标悬停事件中显示两个系列值



使用工具提示格式化程序,我们可以同时显示系列名称和值,但当使用plotoptions事件mouseover完成相同操作时,我无法获得系列名称和数值

工具提示:格式化程序

PlotOption:鼠标悬停

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

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

最新更新