我现在正在使用ShinobiCharts iOS图表框架。

谁能给我一个提供如下功能的示例?

我想做一个功能,当您单击图表的点时可以显示X值和Y值。

最佳答案

您必须实现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
}

关于ios - ShinobiCharts :How can show the X value and Y value when u click the point of the chart,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14994605/

10-12 21:28