@@ -883,7 +883,7 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
883883 this . points = [ ] ;
884884 return null ;
885885 }
886- this . findSumOfPoints ( result ) ;
886+ if ( this . groupTo ) { this . findSumOfPoints ( result ) ; }
887887 this . points = [ ] ;
888888 this . clubbedPoints = [ ] ;
889889 this . sumOfClub = 0 ;
@@ -904,6 +904,7 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
904904 point . isSliced = true ;
905905 }
906906 }
907+ if ( ! this . groupTo ) { this . findSumOfPoints ( result ) ; }
907908 this . lastGroupTo = this . groupTo ;
908909 if ( this . sumOfClub > 0 ) {
909910 const clubPoint : AccPoints = this . generateClubPoint ( ) ;
@@ -975,7 +976,8 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
975976 const length : number = Object . keys ( result ) . length ;
976977 for ( let i : number = 0 ; i < length ; i ++ ) {
977978 if ( ! isNullOrUndefined ( result [ i as number ] ) && ! isNullOrUndefined ( result [ i as number ] [ this . yName ] )
978- && ! isNaN ( result [ i as number ] [ this . yName ] ) ) {
979+ && ! isNaN ( result [ i as number ] [ this . yName ] ) && ( this . points . length && this . points [ i as number ] &&
980+ this . points [ i as number ] . visible && ! isNullOrUndefined ( this . points [ i as number ] . y ) || this . groupTo ) ) {
979981 this . sumOfPoints += Math . abs ( result [ i as number ] [ this . yName ] ) ;
980982 }
981983 }
@@ -1000,6 +1002,7 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
10001002 point . sliceRadius = getValue ( this . radius , data [ i as number ] ) ;
10011003 point . sliceRadius = isNullOrUndefined ( point . sliceRadius ) ? '80%' : point . sliceRadius ;
10021004 point . separatorY = accumulation . intl . formatNumber ( point . y , { useGrouping : accumulation . useGroupingSeparator } ) ;
1005+ this . setVisibility ( point , i ) ;
10031006 this . setAccEmptyPoint ( point , i , data ) ;
10041007 return point ;
10051008 }
@@ -1214,6 +1217,23 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
12141217 }
12151218 }
12161219
1220+ /**
1221+ * To set visiblity for the point.
1222+ *
1223+ * @private
1224+ * @param {AccPoints } point - The point to set visibility.
1225+ * @param {number } i - The index of the point in the data set.
1226+ *
1227+ * @returns {void }
1228+ */
1229+ public setVisibility ( point : AccPoints , i : number ) : void {
1230+ if ( this . accumulation . accumulationLegendModule && this . accumulation . accumulationLegendModule . legendCollections &&
1231+ this . accumulation . accumulationLegendModule . legendCollections [ i as number ] &&
1232+ ! this . accumulation . accumulationLegendModule . legendCollections [ i as number ] . visible ) {
1233+ point . visible = false ;
1234+ }
1235+ }
1236+
12171237 /**
12181238 * Updates the data source for the series.
12191239 *
@@ -1254,14 +1274,14 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
12541274 visiblePoints . push ( ( this . resultData as object [ ] ) [ i as number ] ) ;
12551275 }
12561276 }
1257- this . findSumOfPoints ( visiblePoints ) ;
12581277 this . accumulation . redraw = this . borderRadius ? false : this . accumulation . enableAnimation ;
12591278 this . accumulation . animateSeries = false ;
12601279 const chartDuration : number = this . accumulation . duration ;
12611280 this . accumulation . duration = isNullOrUndefined ( duration ) ? 500 : duration ;
12621281 this . accumulation [ ( firstToLowerCase ( this . type ) + 'SeriesModule' ) ] . initProperties ( this . accumulation , this ) ;
12631282 this . renderPoints ( this . accumulation , getElement ( this . accumulation . element . id + '_Series_' + this . index ) , this . accumulation . redraw , null ,
12641283 null , true ) ;
1284+ this . findSumOfPoints ( visiblePoints ) ;
12651285 if ( this . accumulation . centerLabel . text ) {
12661286 this . accumulation . renderCenterLabel ( true , true ) ;
12671287 }
@@ -1301,11 +1321,11 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
13011321 visiblepoints . push ( ( this . resultData as object [ ] ) [ i as number ] ) ;
13021322 }
13031323 }
1304- this . findSumOfPoints ( visiblepoints ) ;
13051324 const pointIndex : number = this . points . length === 0 ? 0 : this . points [ this . points . length - 1 ] . index + 1 ;
13061325 const colors : string [ ] = this . palettes . length ? this . palettes : getSeriesColor ( this . accumulation . theme ) ;
13071326 const point : AccPoints = this . setPoints ( this . dataSource , pointIndex , colors , this . accumulation ) ;
13081327 this . pushPoints ( point , colors ) ;
1328+ this . findSumOfPoints ( visiblepoints ) ;
13091329 this . accumulation . redraw = this . borderRadius ? false : this . accumulation . enableAnimation ;
13101330 const chartDuration : number = this . accumulation . duration ;
13111331 this . accumulation . duration = isNullOrUndefined ( duration ) ? 500 : duration ;
@@ -1335,7 +1355,6 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
13351355 }
13361356 dataSource . splice ( index , 1 ) ;
13371357 ( this . dataSource as object [ ] ) . splice ( index , 1 ) ;
1338- this . findSumOfPoints ( removepoints ) ;
13391358 this . accumulation . redraw = this . borderRadius ? false : this . accumulation . enableAnimation ;
13401359 this . accumulation . duration = isNullOrUndefined ( duration ) ? 500 : duration ;
13411360 this . points . splice ( index , 1 ) ;
@@ -1344,6 +1363,7 @@ export class AccumulationSeries extends ChildProperty<AccumulationSeries> {
13441363 point . index = i ;
13451364 point . y = this . points [ i as number ] . y ;
13461365 }
1366+ this . findSumOfPoints ( removepoints ) ;
13471367 const element : Element = getElement ( this . accumulation . element . id + '_Series_0_Point_' + ( this . points . length ) ) ;
13481368 if ( element ) {
13491369 element . parentNode . removeChild ( element ) ;
0 commit comments