Calling method: reloadPieChart from PieChart class.
alexoverseer opened this issue · comments
Alexandr Pavlov commented
The values from self.legebtArray and self.dataArray aren't deallocated when I call reloadPieChart. I've modified next method and it works.
- (void)getDataFromDataSource{
//These line of code
[self.legendArray removeAllObjects];
[self.dataArray removeAllObjects];
self.totalCount = @(0);
for(int i = 0; i <[self.dataSource numberOfValuesForPieChart] ; i++){
PieChartDataRenderer *data = [[PieChartDataRenderer alloc] init];
[data setColor:[self.dataSource colorForValueInPieChartWithIndex:i]];
[data setTitle:[self.dataSource titleForValueInPieChartWithIndex:i]];
[data setValue:[self.dataSource valueInPieChartWithIndex:i]];
[self.dataArray addObject:data];
self.totalCount = [NSNumber numberWithFloat:(self.totalCount.floatValue + data.value.floatValue)];
LegendDataRenderer *legendData = [[LegendDataRenderer alloc] init];
[legendData setLegendText:data.title];
[legendData setLegendColor:data.color];
[self.legendArray addObject:legendData];
}
}