2012-07-23 80 views
0

截至目前,我已經與核心情節繪製的線圖是這樣的:核心情節線圖旋轉datalabel

enter image description here

正如你可以看到,一些地塊的標籤是重疊。我認爲如果我可以垂直顯示它們就好了(就像顯示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; 
} 

回答

2

設置labelRotation的情節。

+0

+1謝謝!作品! :) – Jean 2012-07-24 09:21:44