How to rotate Shinobi Pie Chart on user pan(wheel rotation)


#1

Hi,

   I want to rotate the pie chart on user pan gesture or touch begin/touch end.Please help.On rotation and reaching particular point, I want to do that selection animation.

Please help. 


#2

Hi Kandpal4u,

Our API has all of the pieces of the puzzle - you just need to link them together!

  1. You can find out the index of any slice at a given angle using the SChartDonuSeries method indexOfSliceAtAngle:.
  2. You can change the selection of any given slice using the SChartDonutSeries method setSlice:asSelected:.
  3. You can hook into the chart’s events by setting the chart’s delegate property to a custom object implementing the SChartDelegate protocol.

Putting the three together gives you an SChartDelegate implementation that looks something like this:

-(void)sChart:(ShinobiChart *)chart radialSeriesDidEndDecelerating:(SChartRadialSeries *)radialSeries {
    [self selectSliceOnSeries:(SChartDonutSeries *)radialSeries atAngle:0];
}

-(void)selectSliceOnSeries:(SChartDonutSeries *)donut atAngle:(CGFloat)angle {
    NSUInteger index = [donut indexOfSliceAtAngle:angle];
    
    for (int x=0; x<donut.dataSeries.dataPoints.count; x++) {
        [donut setSlice:x asSelected:(x == index)];
    }
}

Thanks,
Jan


#3

Hi Jan,

  Thanks for your help.Its working now.

Thanks,

Deep


#4

Hi,

 One more help needed.I want outer shadow for the pie chart.I am using SChartDonutSeries.Is it possible.Please help.

Thanks,

Deep


#5

Hi kandpal4u,

We currently don’t support a shadow effect on pie or donut charts.

However, we do have a range of effects you can apply to your donut or pie chart by using the “chartEffect” property on your series’ style object.

Here is an example of setting one of these effects:

SChartPieSeries *series = [[SChartPieSeries new] autorelease];
    series.style.chartEffect = SChartRadialChartEffectRounded;
    return series;

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn


#6

Hi Kandpal4u,

You can’t add a shadow to a pie chart, but you can add a number of other visual effects using the chartEffect property on the series style:

http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.7.0/Premium/Normal/html/Classes/SChartDonutSeriesStyle.html#//api/name/chartEffect

Thanks,
Jan Akerman