截至目前,我用 Core plot 绘制的折线图如下所示:
如您所见,地块的一些标签是重叠的。我认为如果我可以垂直显示它们会很好(就像显示 x 轴中的标签一样)。我该怎么做?
这是我的 dataLabelForPlot 代码片段:
-(CPTLayer *) dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index {
NSString *currentlabel = [lineChartPlotXLabel objectAtIndex:index];
CPTMutableTextStyle *textStyle = [[CPTMutableTextStyle alloc] init];
textStyle.color = [CPTColor darkGrayColor];
textStyle.fontSize = 10.0f;
textStyle.fontName = @"Helvetica";
CPTLayer *layer = [[CPTLayer alloc]
initWithFrame:CGRectMake(0.0, 0.0, 70.0, 20.0)];
CPTTextLayer *newLayer = nil;
newLayer = [[CPTTextLayer alloc] initWithText:currentlabel style:textStyle];
[layer addSublayer:newLayer];
return layer;
}