@@ -39,6 +39,7 @@ function LineWithMarkers(scene, uid) {
3939 this . color = 'rgb(0, 0, 0)' ;
4040 this . name = '' ;
4141 this . hoverinfo = 'all' ;
42+ this . connectgaps = true ;
4243
4344 this . idToIndex = [ ] ;
4445 this . bounds = [ 0 , 0 , 0 , 0 ] ;
@@ -103,7 +104,10 @@ function LineWithMarkers(scene, uid) {
103104var proto = LineWithMarkers . prototype ;
104105
105106proto . handlePick = function ( pickResult ) {
106- var index = this . idToIndex [ pickResult . pointId ] ;
107+ var index = pickResult . pointId
108+ if ( pickResult . object !== this . line || this . connectgaps ) {
109+ index = this . idToIndex [ pickResult . pointId ] ;
110+ }
107111
108112 return {
109113 trace : this ,
@@ -248,6 +252,7 @@ proto.update = function(options) {
248252 this . name = options . name ;
249253 this . hoverinfo = options . hoverinfo ;
250254 this . bounds = [ Infinity , Infinity , - Infinity , - Infinity ] ;
255+ this . connectgaps = ! ! options . connectgaps
251256
252257 if ( this . isFancy ( options ) ) {
253258 this . updateFancy ( options ) ;
@@ -461,7 +466,19 @@ proto.updateFancy = function(options) {
461466
462467proto . updateLines = function ( options , positions ) {
463468 if ( this . hasLines ) {
464- this . lineOptions . positions = positions ;
469+ var linePositions = positions
470+ if ( ! options . connectgaps ) {
471+ var p = 0 ;
472+ var x = this . xData ;
473+ var y = this . yData ;
474+ linePositions = new Float32Array ( 2 * x . length )
475+
476+ for ( var i = 0 ; i < x . length ; ++ i ) {
477+ linePositions [ p ++ ] = x [ i ]
478+ linePositions [ p ++ ] = y [ i ]
479+ }
480+ }
481+ this . lineOptions . positions = linePositions
465482
466483 var lineColor = str2RGBArray ( options . line . color ) ;
467484 if ( this . hasMarkers ) lineColor [ 3 ] *= options . marker . opacity ;
0 commit comments