@@ -104,6 +104,8 @@ function LineWithMarkers(scene, uid) {
104104 this . scatter . _trace = this ;
105105 this . fancyScatter = createFancyScatter ( scene . glplot , this . scatterOptions ) ;
106106 this . fancyScatter . _trace = this ;
107+
108+ this . isVisible = false ;
107109}
108110
109111var proto = LineWithMarkers . prototype ;
@@ -232,12 +234,14 @@ function _convertColor(colors, opacities, count) {
232234 */
233235proto . update = function ( options ) {
234236 if ( options . visible !== true ) {
237+ this . isVisible = false ;
235238 this . hasLines = false ;
236239 this . hasErrorX = false ;
237240 this . hasErrorY = false ;
238241 this . hasMarkers = false ;
239242 }
240243 else {
244+ this . isVisible = true ;
241245 this . hasLines = subTypes . hasLines ( options ) ;
242246 this . hasErrorX = options . error_x . visible === true ;
243247 this . hasErrorY = options . error_y . visible === true ;
@@ -250,7 +254,10 @@ proto.update = function(options) {
250254 this . bounds = [ Infinity , Infinity , - Infinity , - Infinity ] ;
251255 this . connectgaps = ! ! options . connectgaps ;
252256
253- if ( this . isFancy ( options ) ) {
257+ if ( ! this . isVisible ) {
258+ this . clear ( ) ;
259+ }
260+ else if ( this . isFancy ( options ) ) {
254261 this . updateFancy ( options ) ;
255262 }
256263 else {
@@ -285,6 +292,22 @@ function allFastTypesLikely(a) {
285292 return true ;
286293}
287294
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+
288311proto . updateFast = function ( options ) {
289312 var x = this . xData = this . pickXData = options . x ;
290313 var y = this . yData = this . pickYData = options . y ;
0 commit comments