ios - Animate Pie Chart slices using Core Plot -
i creating pie chart using core plot. need add animation slices grow 0 360 degrees. using following method animate:
-(void)animateplot:(cptplot *)pplot animated:(bool)banimated { [[cptanimation sharedinstance] removeallanimationoperations]; if (banimated) { cptpiechart *ppiechart = (cptpiechart *)pplot; [cptanimation animate:ppiechart property:@"startangle" from:0 to:m_pi*2 duration:5]; }
there 2 problems: 1. last slice of pie chart animate @ times. incomplete slice after animation has ended. 2. data labels slices indicate values @ opposite end of pie's diameter (180 degrees apart)
how can rid of aforementioned problems , animate pie chart properly? not want entire pie chart rotate. need slices grow 0 respective sizes.
2nd edit
i figured out problem. using following code now:
cptpiechart *ppiechart = (cptpiechart *)pplot; ppiechart.startangle = m_pi; [cptanimation animate:ppiechart property:@"endangle" from:-m_pi to:m_pi duration:0.5];
the chart animates 180 degrees. resolves data label issue. still getting first issue last slice not animate fully. have noticed more apparent when animation duration short. following screenshot. here animation stops:
to make pie chart grow, animate endangle
.
i tried animation in plot gallery example app , didn't see problems labels. can post picture?
Comments
Post a Comment