diff --git a/src/chart/helper/EffectLine.js b/src/chart/helper/EffectLine.js index 233f1a9f129816d77db24fd2ef983165aa06411f..553c8c86a7a06be6880e5de8020443565668aaca 100644 --- a/src/chart/helper/EffectLine.js +++ b/src/chart/helper/EffectLine.js @@ -66,7 +66,12 @@ define(function (require) { var color = effectModel.get('color') || lineData.getItemVisual(idx, 'color'); var symbol = this.childAt(1); var period = effectModel.get('period') * 1000; - if (this._symbolType !== symbolType || period !== this._period) { + var loop = effectModel.get('loop'); + if ( + this._symbolType !== symbolType + || period !== this._period + || loop !== this._loop + ) { symbol = symbolUtil.createSymbol( symbolType, -0.5, -0.5, 1, 1, color ); @@ -74,17 +79,24 @@ define(function (require) { symbol.z2 = 100; this._symbolType = symbolType; this._period = period; + this._loop = loop; this.add(symbol); symbol.__t = 0; - symbol.animate('', true) + var animator = symbol.animate('', loop) .when(period, { __t: 1 }) .delay(idx / lineData.count() * period / 2) - .during(zrUtil.bind(updateSymbolPosition, symbol)) - .start(); + .during(zrUtil.bind(updateSymbolPosition, symbol)); + if (!loop) { + var self = this; + animator.done(function () { + self.remove(symbol); + }); + } + animator.start(); } // Shadow color is same with color in default symbol.setStyle('shadowColor', color); diff --git a/src/chart/lines/LinesSeries.js b/src/chart/lines/LinesSeries.js index dad2b686b6c26e1a5cd4ef06b32f657d0bae8813..ede7d3cb68659d0ae003087b0155ae017596a5f3 100644 --- a/src/chart/lines/LinesSeries.js +++ b/src/chart/lines/LinesSeries.js @@ -85,6 +85,7 @@ define(function (require) { period: 4, symbol: 'circle', symbolSize: 3, + loop: true, // Length of trail, 0 - 1 trailLength: 0.2 // Same with lineStyle.normal.color