SChartLegend alter label


#1

How can i alter the text of a chart legend on the sChartRenderFinished ?

i was trying the following code but the count is allways 0

for (int i = 0; i < chart.legend.labels.count; i++) {
        UILabel *legendLabel = [chart.legend.labels objectAtIndex:i];
        //TO STUFF
    }

#2

Any ideas ? 


#3

Hi Moonlace, 

Do you need to alter the labels after the chart has rendered or can you just set series.title when you pass the series to the datasource?


#4

i need to alter the labels after the chart has rendered.


#5

The legend will be contructured during render. You’ll need to do the modifications after layout using the delegate:

- (void)sChartRenderFinished:(ShinobiChart *)chart {
    
    if (_firstRun) {
        _firstRun = NO;
        
        for (UILabel *l in chart.legend.labels) {
            l.text = @"Shinobi";
        }
    }
}

#6

That is what i am trying to do but it doesnt enter the loop.

I belive that at that point in time the legend is still empy or something since the legend apears with title for each series.


#7

ok it now enters the loop but the names dont change