@@ -114,11 +114,13 @@ proto.handlePick = function(pickResult) {
114
114
index = this . idToIndex [ pickResult . pointId ] ;
115
115
}
116
116
117
+ var x = this . pickXData [ index ] ;
118
+
117
119
return {
118
120
trace : this ,
119
121
dataCoord : pickResult . dataCoord ,
120
122
traceCoord : [
121
- Number ( this . pickXData [ index ] ) , // non-fancy scattergl has Dates
123
+ isNumeric ( x ) || ! Lib . isDateTime ( x ) ? x : Lib . dateTime2ms ( x ) ,
122
124
this . pickYData [ index ]
123
125
] ,
124
126
textLabel : Array . isArray ( this . textLabels ) ?
@@ -270,7 +272,7 @@ proto.updateFast = function(options) {
270
272
pId = 0 ,
271
273
ptr = 0 ;
272
274
273
- var xx , yy ;
275
+ var xx , yy , fastType ;
274
276
275
277
// TODO add 'very fast' mode that bypasses this loop
276
278
// TODO bypass this on modebar +/- zoom
@@ -279,18 +281,24 @@ proto.updateFast = function(options) {
279
281
yy = y [ i ] ;
280
282
281
283
// check for isNaN is faster but doesn't skip over nulls
282
- if ( ! isNumeric ( yy ) ) continue ;
283
- if ( ! isNumeric ( xx ) && ! ( xx instanceof Date ) ) continue ;
284
+ fastType = isNumeric ( xx ) || xx instanceof Date ;
284
285
285
- idToIndex [ pId ++ ] = i ;
286
+ if ( isNumeric ( yy ) && ( fastType || Lib . isDateTime ( xx ) ) ) {
286
287
287
- positions [ ptr ++ ] = xx ;
288
- positions [ ptr ++ ] = yy ;
288
+ if ( ! fastType ) {
289
+ xx = Lib . dateTime2ms ( xx ) ;
290
+ }
291
+
292
+ idToIndex [ pId ++ ] = i ;
289
293
290
- bounds [ 0 ] = Math . min ( bounds [ 0 ] , xx ) ;
291
- bounds [ 1 ] = Math . min ( bounds [ 1 ] , yy ) ;
292
- bounds [ 2 ] = Math . max ( bounds [ 2 ] , xx ) ;
293
- bounds [ 3 ] = Math . max ( bounds [ 3 ] , yy ) ;
294
+ positions [ ptr ++ ] = xx ;
295
+ positions [ ptr ++ ] = yy ;
296
+
297
+ bounds [ 0 ] = Math . min ( bounds [ 0 ] , xx ) ;
298
+ bounds [ 1 ] = Math . min ( bounds [ 1 ] , yy ) ;
299
+ bounds [ 2 ] = Math . max ( bounds [ 2 ] , xx ) ;
300
+ bounds [ 3 ] = Math . max ( bounds [ 3 ] , yy ) ;
301
+ }
294
302
}
295
303
296
304
positions = truncate ( positions , ptr ) ;
0 commit comments