动画时核心绘图饼图未满

时间:2014-04-11 14:08:52

标签: cocoa-touch animation core-plot

动画饼图时我的行为不一致: - 完整的动画 - 最后有一点间隙的动画。

下面是我的代码和结果!

图片链接

动画与差距 http://s604.photobucket.com/user/Jcljk/media/IMG_5865_zps83ac73a6.png.html

完整动画 http://s604.photobucket.com/user/Jcljk/media/IMG_5867_zps7beff336.png.html

感谢您的帮助..谢谢

-(void)configureGraph {

    ///********************** Pie Chart* ***************//////
    // 1 - Create and initialize graph
    CPTGraph *graph = [[CPTXYGraph alloc] initWithFrame:self.hostView.bounds];
    self.hostView.hostedGraph = graph;
    graph.paddingLeft = 0.0f;
    graph.paddingTop = 0.0f;
    graph.paddingRight = 0.0f;
    graph.paddingBottom = 0.0f;
    graph.axisSet = nil;
    graph.plotAreaFrame.borderLineStyle = nil;
    // 2 - Set up text style
    CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
    textStyle.color = [CPTColor grayColor];
    textStyle.fontName = @"Helvetica-Bold";
    textStyle.fontSize = 16.0f;
    self.selectedTheme = [CPTTheme themeNamed:kCPTPlainWhiteTheme];
    [graph applyTheme:self.selectedTheme];

        ///********************** End of Pie Chart* ***************//////


}

-(void)configureChart {
    // 1 - Get reference to graph
    CPTGraph *graph = self.hostView.hostedGraph;
    // 2 - Create chart
    CPTPieChart *piePlot = [[CPTPieChart alloc] init];
    piePlot.dataSource = self;
    piePlot.delegate = self;
    piePlot.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;

    piePlot.identifier = graph.title;
    piePlot.startAngle = 0;
    piePlot.endAngle = M_PI*2;//2 pi is 1 circle
    piePlot.sliceDirection = CPTPieDirectionClockwise;
    piePlot.identifier = @"Pie Chart";

    graph.plotAreaFrame.borderLineStyle = nil;

    [CPTAnimation animate:piePlot
                 property:@"startAngle"
                     from:0
                       to:M_PI*2
                 duration:0.5];
  [graph addPlot:piePlot];
}

0 个答案:

没有答案