File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 201201 function getEventHandler ( scope , action , triggerOnlyOnChange ) {
202202 var lastState = null ;
203203 return function ( evt ) {
204- var atEvent = scope . chart . getElementsAtEvent || scope . chart . getPointsAtEvent ;
205- if ( atEvent ) {
206- var activePoints = atEvent . call ( scope . chart , evt ) ;
207- if ( triggerOnlyOnChange === false || angular . equals ( lastState , activePoints ) === false ) {
208- lastState = activePoints ;
209- scope [ action ] ( activePoints , evt ) ;
204+ var atEvent = scope . chart . getElementAtEvent || scope . chart . getPointAtEvent ;
205+ var atEvents = scope . chart . getElementsAtEvent || scope . chart . getPointsAtEvent ;
206+ if ( atEvents ) {
207+ // get all point
208+ var points = atEvents . call ( scope . chart , evt ) ;
209+ var activePoint ;
210+ // get active point
211+ if ( atEvent ) {
212+ var arrayActivePoint = atEvent . call ( scope . chart , evt ) ; // return array of 0 or 1 point
213+ if ( arrayActivePoint . length ) {
214+ activePoint = arrayActivePoint [ 0 ] ;
215+ }
216+ }
217+
218+ if ( triggerOnlyOnChange === false || angular . equals ( lastState , points ) === false ) {
219+ lastState = points ;
220+ scope [ action ] ( points , evt , activePoint ) ;
210221 }
211222 }
212223 } ;
You can’t perform that action at this time.
0 commit comments