@@ -104,6 +104,8 @@ function LineWithMarkers(scene, uid) {
104
104
this . scatter . _trace = this ;
105
105
this . fancyScatter = createFancyScatter ( scene . glplot , this . scatterOptions ) ;
106
106
this . fancyScatter . _trace = this ;
107
+
108
+ this . isVisible = false ;
107
109
}
108
110
109
111
var proto = LineWithMarkers . prototype ;
@@ -232,12 +234,14 @@ function _convertColor(colors, opacities, count) {
232
234
*/
233
235
proto . update = function ( options ) {
234
236
if ( options . visible !== true ) {
237
+ this . isVisible = false ;
235
238
this . hasLines = false ;
236
239
this . hasErrorX = false ;
237
240
this . hasErrorY = false ;
238
241
this . hasMarkers = false ;
239
242
}
240
243
else {
244
+ this . isVisible = true ;
241
245
this . hasLines = subTypes . hasLines ( options ) ;
242
246
this . hasErrorX = options . error_x . visible === true ;
243
247
this . hasErrorY = options . error_y . visible === true ;
@@ -250,7 +254,10 @@ proto.update = function(options) {
250
254
this . bounds = [ Infinity , Infinity , - Infinity , - Infinity ] ;
251
255
this . connectgaps = ! ! options . connectgaps ;
252
256
253
- if ( this . isFancy ( options ) ) {
257
+ if ( ! this . isVisible ) {
258
+ this . clear ( ) ;
259
+ }
260
+ else if ( this . isFancy ( options ) ) {
254
261
this . updateFancy ( options ) ;
255
262
}
256
263
else {
@@ -285,6 +292,22 @@ function allFastTypesLikely(a) {
285
292
return true ;
286
293
}
287
294
295
+ proto . clear = function ( ) {
296
+ this . lineOptions . positions = new Float64Array ( 0 ) ;
297
+ this . line . update ( this . lineOptions ) ;
298
+
299
+ this . errorXOptions . positions = new Float64Array ( 0 ) ;
300
+ this . errorX . update ( this . errorXOptions ) ;
301
+
302
+ this . errorYOptions . positions = new Float64Array ( 0 ) ;
303
+ this . errorY . update ( this . errorYOptions ) ;
304
+
305
+ this . scatterOptions . positions = new Float64Array ( 0 ) ;
306
+ this . scatterOptions . glyphs = [ ] ;
307
+ this . scatter . update ( this . scatterOptions ) ;
308
+ this . fancyScatter . update ( this . scatterOptions ) ;
309
+ } ;
310
+
288
311
proto . updateFast = function ( options ) {
289
312
var x = this . xData = this . pickXData = options . x ;
290
313
var y = this . yData = this . pickYData = options . y ;
0 commit comments