Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have implemented pie piece selection in my iPad app with CorePlot 0.2.2. Your guess to use <strong>(void)pieChart:sliceWasSelectedAtRecordIndex:</strong> is correct, but maybe you have forgotten to declare the following two things:</p> <ul> <li>Does your controller declares the <strong>CPPieChartDelegate</strong> protocol?</li> <li>Did you tell the pie chart that your controller is its <strong>delegate</strong>?</li> </ul> <p>My view controller looks like this in the header declaration:</p> <pre><code>@interface YourViewController : UIViewController &lt; CPPieChartDataSource, CPPieChartDelegate, ... &gt; { ... CPXYGraph* pieGraph; CPGraphHostingView* pieView; } @property (nonatomic, retain) IBOutlet CPGraphHostingView* pieView; - (void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index; @end </code></pre> <p>The creation of the pie chart is called during the <strong>(void)viewDidLoad</strong>, where I set the data source and the delegate of the pie chart:</p> <pre><code>-(void)viewDidLoad { [self createPie]; } -(void)createPie { pieGraph = [[CPXYGraph alloc] initWithFrame:CGRectZero]; pieGraph.axisSet = nil; self.pieView.hostedGraph = pieGraph; CPPieChart *pieChart = [[CPPieChart alloc] init]; // This is important in order to have your slice selection handler called! pieChart.delegate = self; pieChart.dataSource = self; pieChart.pieRadius = 80.0; [pieGraph addPlot:pieChart]; [pieChart release]; } - (void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index { // Do whatever you need when the pie slice has been selected. } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload