@@ -41,9 +41,8 @@ function ($, _) {
41
41
} ;
42
42
43
43
this . getMultiSeriesPlotHoverInfo = function ( seriesList , pos ) {
44
- var value , i , series , hoverIndex , hoverDistance ;
44
+ var value , i , series , hoverIndex , hoverDistance , pointTime ;
45
45
var results = [ ] ;
46
- var seriesTimes = new Array ( seriesList . length ) ;
47
46
48
47
//now we know the current X (j) position for X and Y values
49
48
var last_value = 0 ; //needed for stacked values
@@ -62,13 +61,8 @@ function ($, _) {
62
61
}
63
62
64
63
hoverIndex = this . findHoverIndexFromData ( pos . x , series ) ;
65
-
66
- // Store distance for each highlighted point
67
64
hoverDistance = Math . abs ( pos . x - series . data [ hoverIndex ] [ 0 ] ) ;
68
- seriesTimes [ i ] = {
69
- time : series . data [ hoverIndex ] [ 0 ] ,
70
- distance : hoverDistance
71
- } ;
65
+ pointTime = series . data [ hoverIndex ] [ 0 ] ;
72
66
73
67
if ( series . stack ) {
74
68
if ( panel . tooltip . value_type === 'individual' ) {
@@ -88,15 +82,22 @@ function ($, _) {
88
82
// stacked and steppedLine plots can have series with different length.
89
83
// Stacked series can increase its length on each new stacked serie if null points found,
90
84
// to speed the index search we begin always on the last found hoverIndex.
91
- var newhoverIndex = this . findHoverIndexFromDataPoints ( pos . x , series , hoverIndex ) ;
92
- results . push ( { value : value , hoverIndex : newhoverIndex , color : series . color , label : series . label } ) ;
93
- } else {
94
- results . push ( { value : value , hoverIndex : hoverIndex , color : series . color , label : series . label } ) ;
85
+ hoverIndex = this . findHoverIndexFromDataPoints ( pos . x , series , hoverIndex ) ;
86
+ hoverDistance = Math . abs ( pos . x - series . data [ hoverIndex ] [ 0 ] ) ;
95
87
}
88
+
89
+ results . push ( {
90
+ value : value ,
91
+ hoverIndex : hoverIndex ,
92
+ color : series . color ,
93
+ label : series . label ,
94
+ time : pointTime ,
95
+ distance : hoverDistance
96
+ } ) ;
96
97
}
97
98
98
99
// Find point which closer to pointer
99
- results . time = _ . min ( seriesTimes , 'distance' ) . time ;
100
+ results . time = _ . min ( results , 'distance' ) . time ;
100
101
101
102
return results ;
102
103
} ;
0 commit comments