ShinobiCharts:当你点击图表的点时,如何显示X值和Y值

nul*_*cgo 5 charts ios shinobi

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

有谁能给我一个例子,提供如下图所示的功能? 在此输入图像描述

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

use*_*850 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 
}
Run Code Online (Sandbox Code Playgroud)

您也可以使用以下方法进行点选择

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