Ashwinkumar Mangrulkar
Ashwinkumar Mangrulkar

Reputation: 2965

How to increase radius of particular slice of pie chart in core plot api?

I want to increase radius of particular slice, so that one of slice look bigger and other with the same circle, How to implement this, please help me? Follow the following image.

enter image description here

Upvotes: 0

Views: 535

Answers (2)

Eric Skroch
Eric Skroch

Reputation: 27381

Since you cannot control the slice radius independently for each slice in Core Plot, use a second plot and give it the larger radius. Both plots can use the same data. Implement the -sliceFillForPieChart:recordIndex: datasource method for both plots. Return [NSNull null] to draw an empty slice at the given index. In your example, return a fill at one index on the larger plot and NSNull everywhere else. Do the opposite on the smaller plot.

Upvotes: 2

Mike Lischke
Mike Lischke

Reputation: 53357

Since there are only 2 radii (inner and outer radius) it is not possible to increase the size of a single piece. However, what you can do is to offset a single piece so it stands out:

enter image description here

For this you can set the radial offset of one or more slices. One way to do this is to bind them to an array controller with the offset values like this:

[earningsPlot bind: CPTPieChartBindingPieSliceRadialOffsets
          toObject: earningsPlotRadialOffsets
       withKeyPath: @"arrangedObjects"
           options: nil];

Upvotes: 0

Related Questions