Core Plot中DataSource和Delegate

本文详细介绍CorePlot框架在iOS开发中的应用,包括折线图、饼图、柱状图等统计图表的显示与交互。列举了多种delegate方法及datasource接口,并解释其功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

最近探究在IOS中,折线图,饼图,柱形图等数据统计方面的显示和操作。

选择了开源的Core Plot框架

最近探究在IOS中,折线图,饼图,柱形图等数据统计方面的显示和操作。

选择了开源的Core Plot框架

现在将框架中的delegate和data source做一个简单的陈列,作为自己的备忘之用。

首先是delegate

1.<CPTAxisDelegate> 关于坐标系(轴线Axis)的delegate

  (a) -(BOOL)axis:(CPTAxis *)axis shouldUpdateAxisLabelAtLocations:(NSSet *)locations

  (b) -(BOOL)axis:(CPTAxis *)axis shouldUpdateMinorAxisLabelAtLocations:(NSSet *)locations

  (c) -(void)axisDidRelabel:(CPTAxis *)axis

  (d) -(BOOL)axisShouldRelabel:(CPTAxis *)axis

2.<CPTPlotSpaceDelegate> 关于点空间的delegate

  (a) -(void)plotSpace:(CPTPlotSpace *)space didChangePlotRangeForCoordinate:(CPTCoordinate)coordinate

  (b) -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(id)event

  (c) -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandelPointingDeviceDownEvent:(id) event atPoint:(CGPoint) point

  (d) -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id) event atPoint:(CGPoint) point

  (e) -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandelPointingDeviceUpEvent:(id) event atPoint:(CGPoint) point

  (f) -(BOOL)plotSpace:(CPTPlotSpace *)space shouldScaleBy:(CGPoint) interactionScale aboutPoint:(CGPoint) interactionPoint

  (g) -(CPTPlotRange *) plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate

  (h) -(CGpoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint) proposedDisplacementVector

3.<CPTLegendDelegate> 关于图例Legend的delegate

  (a) -(BOOL)legend:(CPTLegend *)legend shouldDrawSwatchAtIndex:(NSUInteger)index forPlot:(CPTPlot *) plot inRect:(CGRect) rect inContext:(CGContextRef)context

4.<CPTBarPlotDelegate> 关于柱形图 Plot的delegate

  (a) -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger) index

5.<CPTPieChartDelegate> 关于饼图的delegate

  (a) -(void)pieChart:(CPTPieChart *) plot sliceWasSelectedAtRecordIndex:(NSUInteger )index

6.<CPTScatterPlotDelegate>  关于散列点的Scatter的delegate

  (a) -(void)scatterPlot:(CPTScatterPlot *) plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger )index

下面是几个data source

1.<CPTPlotDataSource>

  (a) -(CPTNumericData *)dataForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange) indexRange

  (b) -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index

  (c) -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger) fieldEnum recordIndex:(NSUInteger) index

  (d) -(double *)doublesForPlot:(CPTPlot *) plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange

  (e) -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index

  (f) -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot

  (g) -(NSArray *)numbersForPlot:(CPTPlot *) plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange

  1.1<CPTBarPlotDataSource> 柱形图

  1.2<CPTPieChartDataSource> 饼图

  1.3<CPTScatterPlotDataSource> 散列点

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值