objective c - How to pass touch event to a pie chart -


i new core plot framework , facing issue:

i cpgraphhostigview draw pie chart. cpgraphhostigview doesn't detect touch events have uiview on can detect touches. how can pass touch events pie chart cppiechartdelegate method.

- (void)piechart:(cppiechart *)plot slicewasselectedatrecordindex:(nsuinteger)index

gets invoked.

any appreciated. in advance.

-ravi

cpgraphhostingview inherits uiview, inherits uiresponder. therefore, cpgraphhostingviewdoes detect touch events.

here steps should follow in order detect touch events on pie chart slices :

  1. add cpgraphhostingview view in interface builder. can achieve adding simple uiview , change class manually cpgraphhostingview;
  2. declare hosting view in code:

    // in view controller .h file:     ...     cpgraphhostingview *graphhosting; }  @property (nonatomic, retain) iboutlet cpgraphhostingview *graphhosting;   // in view controller .h file: @synthesize graphhosting; 
  3. make connection iboutlet in interface builder;

  4. initialize graph , link graph hosting view:

    self.graph = [[cpxygraph alloc] initwithframe: self.graphhosting.bounds]; self.graphhosting.hostedgraph = self.graph; 
  5. initialize pie chart , set view controller delegate:

    cppiechart *piechart = [[cppiechart alloc] init]; piechart.delegate = self; ... [self.graph addplot:piechart] [piechart release]; 
  6. add <cppiechartdelegate> view controller's declaration, , implement method:

    - (void)piechart:(cppiechart *)plot slicewasselectedatrecordindex:(nsuinteger)index 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -