Altere a aparência do título de um gráfico de setores principa
Eu gostaria de usar um plano de fundo preto liso no meu gráfico de pizza que eu gero usando o Core Plot. Eu tenho o gráfico renderizando muito bem, mas o título está em um blackColor padrão que é difícil de ver em um fundo preto. Eu sei que está sendo exibido, porque quando eu mudo o tema, posso vê-lo em preto. Alguém pode me dizer como alterar a cor do texto, como fiz com os rótulos de dados?
Aqui está um trecho do meu código ...
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
CPTGraphHostingView *hostingView = (CPTGraphHostingView*)self.view;
hostingView.hostedGraph = graph;
CPTPieChart *pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.pieRadius = 80.0;
pieChart.identifier = @"PieChart1";
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionCounterClockwise;
[graph addPlot:pieChart];
graph.title = @"Proportion of Sessions per Sport";
}
-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index {
static CPTMutableTextStyle *whiteText = nil;
if (!whiteText) {
whiteText = [[CPTMutableTextStyle alloc] init];
whiteText.color = [CPTColor whiteColor];
}
CPTLayer *layer = [[CPTLayer alloc] initWithFrame:CGRectMake(50, 50, 100, 20)];
CPTTextLayer *newLayer = nil;
newLayer = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%@", [pieLabels objectAtIndex:index]] style:whiteText];
[layer addSublayer:newLayer];
return newLayer;
}
-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
return [self.pieData count];
}
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
return [self.pieData objectAtIndex:index];
}
-(NSString *)legendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index {
return [NSString stringWithFormat:@"Pie Slice %u", index];
}
Muito obrigado antecipadamente por qualquer assistência / aconselhamento / links oferecidos ...