iPhone CorePlot: Chart with user Touch Event

2019-05-08 19:41发布

问题:

I am now using Core-plot to develop application. I am looking for some touch event for user touch one point of the chart, then it show up the price.

When i take a look of the CorePlot website, It has a application show what i need http://code.google.com/p/core-plot/wiki/AppsUsingCorePlot

I really want to do this function by Core-plot, i am now using CorePlot 0.4 i want to do the following function

I really want to have a touch event which can show the specify price of the point user touch.

Thank you very much!!

回答1:

CorePlot provides a lot of ways to detect user touches:

For plots:

-(void)barPlot:(CPBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index;
-(void)scatterPlot:(CPScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index;
-(void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index;

For plot space:

@protocol CPPlotSpaceDelegate <NSObject>
-(BOOL)plotSpace:(CPPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point;
-(BOOL)plotSpace:(CPPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)point;
-(BOOL)plotSpace:(CPPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point;


回答2:

The Mac CPTTestApp example program included with Core Plot shows how to do exactly what you describe. Look at the Point Selection Demo under the View menu.



回答3:

use gesture recolonization for this it work fine.in first tap u show price and second hide.