Skip to content

Calling method: reloadPieChart from PieChart class. #20

@alexoverseer

Description

@alexoverseer

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];
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions