2013-02-21 97 views

回答

4

您必須實現SChartDelegate方法:

對於例如

- (void)sChart:(ShinobiChart *)chart toggledSelectionForSeries:(SChartSeries *)series nearPoint:(SChartDataPoint *)dataPoint atPixelCoordinate:(CGPoint)pixelPoint{ 
NSLog(@"x value:%@",dataPoint.xValue); 
NSLog(@"y value:%@",dataPoint.yValue); 
//here you can create an label to show the x/y values or even can add an annotation 
} 

,你也可以使用點選擇以下方法

- (void)sChart:(ShinobiChart *)chart toggledSelectionForPoint:(SChartDataPoint *)dataPoint inSeries:(SChartSeries *)series atPixelCoordinate:(CGPoint)pixelPoint{ 
    //Your code goes here 
} 
3

你必須CrossHairEnabled設置爲YES是這樣的:

- (SChartSeries*)barSeriesForKey:(NSString*)key { 

SChartBarSeries *series = [SChartBarSeries new]; 

series.stackIndex = [NSNumber numberWithInt:1]; 
series.crosshairEnabled = YES; // this is what you want 
series.title = [self titleForKey:key]; 

if ([key isEqualToString:land]) { 

    series.style = [self.theme barSeriesStyleForSeriesAtIndex:3 selected:NO]; 
} 

return series; 
} 
+0

謝謝你,幫我解決我的問題! – 2013-06-03 16:07:00

2

爲了顯示默認準星你需要設置以下內容:

啓用十字準線系列

-(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(int)index { 
    SChartLineSeries *lineSeries = [[SChartLineSeries alloc] init]; 
    lineSeries.style.lineColor = [UIColor darkGrayColor]; 
    lineSeries.crosshairEnabled = YES; 
    lineSeries.selectionMode = SChartSelectionPoint; 
    return lineSeries; 
} 

使用默認的十字線提示

[chart.crosshair setDefaultTooltip]; 
相關問題