@@ -279,6 +279,8 @@ proto.update = function(options) {
279
279
280
280
var gl = this . plot . gl
281
281
282
+ var connectGaps = ! ! options . connectGaps
283
+
282
284
this . color = ( options . color || [ 0 , 0 , 1 , 1 ] ) . slice ( )
283
285
this . width = + ( options . width || 1 )
284
286
@@ -327,6 +329,11 @@ proto.update = function(options) {
327
329
for ( var i = 0 ; i < numPoints ; ++ i ) {
328
330
var ax = data [ 2 * i ]
329
331
var ay = data [ 2 * i + 1 ]
332
+
333
+ if ( isNaN ( ax ) || isNaN ( ay ) ) {
334
+ continue
335
+ }
336
+
330
337
bounds [ 0 ] = Math . min ( bounds [ 0 ] , ax )
331
338
bounds [ 1 ] = Math . min ( bounds [ 1 ] , ay )
332
339
bounds [ 2 ] = Math . max ( bounds [ 2 ] , ax )
@@ -347,20 +354,26 @@ proto.update = function(options) {
347
354
var pickDataPtr = pickData . length
348
355
var ptr = numPoints
349
356
350
- this . vertCount = 6 * ( numPoints - 1 )
357
+ var count = 0
351
358
352
359
while ( ptr > 1 ) {
353
360
var id = -- ptr
354
361
var ax = data [ 2 * ptr ]
355
362
var ay = data [ 2 * ptr + 1 ]
356
363
357
- ax = ( ax - bounds [ 0 ] ) / ( bounds [ 2 ] - bounds [ 0 ] )
358
- ay = ( ay - bounds [ 1 ] ) / ( bounds [ 3 ] - bounds [ 1 ] )
359
-
360
364
var next = id - 1
361
365
var bx = data [ 2 * next ]
362
366
var by = data [ 2 * next + 1 ]
363
367
368
+ if ( isNaN ( ax ) || isNaN ( ay ) || isNaN ( bx ) || isNaN ( by ) ) {
369
+ continue
370
+ }
371
+
372
+ count += 1
373
+
374
+ ax = ( ax - bounds [ 0 ] ) / ( bounds [ 2 ] - bounds [ 0 ] )
375
+ ay = ( ay - bounds [ 1 ] ) / ( bounds [ 3 ] - bounds [ 1 ] )
376
+
364
377
bx = ( bx - bounds [ 0 ] ) / ( bounds [ 2 ] - bounds [ 0 ] )
365
378
by = ( by - bounds [ 1 ] ) / ( bounds [ 3 ] - bounds [ 1 ] )
366
379
@@ -415,8 +428,9 @@ proto.update = function(options) {
415
428
pickData [ -- pickDataPtr ] = akey1
416
429
}
417
430
418
- this . lineBuffer . update ( lineData )
419
- this . pickBuffer . update ( pickData )
431
+ this . vertCount = 6 * count
432
+ this . lineBuffer . update ( lineData . subarray ( lineDataPtr ) )
433
+ this . pickBuffer . update ( pickData . subarray ( pickDataPtr ) )
420
434
421
435
pool . free ( lineData )
422
436
pool . free ( pickData )
0 commit comments