IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]Core Plot中DataSource和Delegate

    grumoon发表于 2014-08-05 10:52:04
    love 0

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

    选择了开源的Core Plot框架

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

    选择了开源的Core Plot框架

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

    首先是delegate

    1. 关于坐标系(轴线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. 关于点空间的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. 关于图例Legend的delegate

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

    4. 关于柱形图 Plot的delegate

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

    5. 关于饼图的delegate

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

    6. 关于散列点的Scatter的delegate

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

    下面是几个data source

    1.

      (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 柱形图

      1.2 饼图

      1.3 散列点



沪ICP备19023445号-2号
友情链接