0
코어 플롯 프레임 워크를 사용하여 그래프를 그리는 중입니다. 사용자가 폴트 기호를 탭하면 텍스트가 표시됩니다. 하지만 제 문제는 텍스트가 플롯 기호에 겹쳐져 있다는 것입니다. 이 문제를 극복하는 방법. 제발 도와주세요. 선형 차트에서 plotsymbol과 plotsymboltext 사이의 간격을 늘리는 방법은 무엇입니까?
- (void) scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index{
if ([plot.identifier isEqual:@"Green Plot"]) {
selectedLineIndex1 = index;
selectedLineIndex2 = -1;
[graph reloadData];
}
else if ([plot.identifier isEqual:@"Blue Plot"]) {
selectedLineIndex1 = -1;
selectedLineIndex2 = index;
[graph reloadData];
} }
- (CPTLayer *) dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index {
// Setup a style for the annotation text
CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle];
hitAnnotationTextStyle.color = [CPTColor blackColor];
hitAnnotationTextStyle.fontSize = 18.0f;
hitAnnotationTextStyle.fontName = @"Verdana-Bold";
// Now add the annotation text to the plot
CPTTextLayer *selectedText = [CPTTextLayer layer];
selectedText.textStyle = hitAnnotationTextStyle;
selectedText.position = CGPointMake(0.0,40.0f);
if (index == selectedLineIndex1 && [plot.identifier isEqual:@"Green Plot"]) {
selectedText.text = [NSString stringWithFormat:@"%.1f",[[dataForPlot objectAtIndex:index] floatValue]];
}
else if (index == selectedLineIndex2 && [plot.identifier isEqual:@"Blue Plot"]) {
selectedText.text = [NSString stringWithFormat:@"%.1f",[[yPoints objectAtIndex:index] floatValue]];
}
return selectedText;}
같은 또는 다른 방법이 그냥 날 몇 가지를 제공하시기 바랍니다 제안 견본.
미리 감사드립니다.
어떻게 그려야합니까? 주석? 데이터 레이블? 다른 방법이 있니? –
Datalables를 사용하고 있습니다. – Thukaram