@@ -190,7 +190,6 @@ ScatterRegl.calc = function calc(container, trace) {
190
190
lineOptions . thickness = trace . line . width ;
191
191
lineOptions . color = trace . line . color ;
192
192
lineOptions . opacity = trace . opacity ;
193
- lineOptions . join = trace . opacity === 1.0 ? 'rect' : 'round' ;
194
193
lineOptions . overlay = true ;
195
194
196
195
var dashes = ( DASHES [ trace . line . dash ] || [ 1 ] ) . slice ( ) ;
@@ -238,6 +237,33 @@ ScatterRegl.calc = function calc(container, trace) {
238
237
else {
239
238
linePositions = positions ;
240
239
}
240
+
241
+ // If we have data with gaps, we ought to use rect joins
242
+ // FIXME: get rid of this
243
+ var hasNaNs = false ;
244
+ for ( i = 0 ; i < linePositions . length ; i ++ ) {
245
+ if ( isNaN ( linePositions [ i ] ) ) {
246
+ hasNaNs = true ;
247
+ break ;
248
+ }
249
+ }
250
+ lineOptions . join = ( hasNaNs || linePositions . length > TOO_MANY_POINTS ) && ! hasMarkers ? 'rect' : 'round'
251
+
252
+ // fill gaps
253
+ if ( hasNaNs && trace . connectgaps ) {
254
+ var lastX = linePositions [ 0 ] , lastY = linePositions [ 1 ] ;
255
+ for ( i = 0 ; i < linePositions . length ; i += 2 ) {
256
+ if ( isNaN ( linePositions [ i ] ) || isNaN ( linePositions [ i + 1 ] ) ) {
257
+ linePositions [ i ] = lastX
258
+ linePositions [ i + 1 ] = lastY
259
+ }
260
+ else {
261
+ lastX = linePositions [ i ] ;
262
+ lastY = linePositions [ i + 1 ] ;
263
+ }
264
+ }
265
+ }
266
+
241
267
lineOptions . positions = linePositions ;
242
268
}
243
269
@@ -360,7 +386,6 @@ ScatterRegl.calc = function calc(container, trace) {
360
386
Axes . expand ( yaxis , y , { padded : true , ppad : sizes } ) ;
361
387
}
362
388
else {
363
- // console.log(x, xOptions, xa._min)
364
389
var size = scatterOptions . size = markerSizeFunc ( markerOpts && markerOpts . size || 10 ) ;
365
390
scatterOptions . borderSizes = markerOpts . line . width * 0.5 ;
366
391
@@ -479,6 +504,12 @@ ScatterRegl.calc = function calc(container, trace) {
479
504
scene . draw ( ) ;
480
505
}
481
506
}
507
+ else {
508
+ if ( hasFill && ! scene . fill2d ) scene . fill2d = true ;
509
+ if ( hasMarkers && ! scene . marker2d ) scene . marker2d = true ;
510
+ if ( hasLines && ! scene . line2d ) scene . line2d = true ;
511
+ if ( hasError && ! scene . error2d ) scene . error2d = true ;
512
+ }
482
513
483
514
// In case if we have scene from the last calc - reset data
484
515
if ( ! scene . dirty ) {
0 commit comments