Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I implemented corePlot in my xcode project. I have a pie chart that I'm trying to animate. Here is my code:

Objective-C
CPTGraph *graph = self.hostView.hostedGraph;

CPTPieChart *pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.delegate = self;
pieChart.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionClockwise;

[graph addPlot:pieChart];


This is what I tried:
Objective-C
[CPTAnimation animate:pieChart property:@"startAngle" from:pieChart.startAngle to:pieChart.endAngle duration:1.0];

That didn't have the desired effect. The chart would show for a second, then disappear.

I'm trying to get this effect: http://jsfiddle.net/ozgr1wfx/
Posted

1 solution

You havent set an end angle. :-O

Does your code work? Are delegate and data source protocols correctly set and prepared?
You can always animate "by hand". Setup a timer with a frame rate of 1/60 of a second and draw all piece by piece.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900