Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:09:53+00:00 2026-06-13T13:09:53+00:00

I am using core plot frame work ,i am refresh the view after some

  • 0

I am using core plot frame work ,i am refresh the view after some time i got the error for
“CoreAnimation: failed to allocate 1971232 bytes”.
here am attaching my code for plotting chat

- (void)ipadDraw
{
    CPTGradient *overlayGradient = [[[CPTGradient alloc] init] autorelease];
    overlayGradient.gradientType = CPTGradientTypeRadial;
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.0] atPosition:0.0];
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.5] atPosition:0.9];
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.8] atPosition:1.0];
    CGRect rect=self.view.bounds;


    if(currentOrientation   == UIInterfaceOrientationPortrait || currentOrientation== UIInterfaceOrientationPortraitUpsideDown)
    {

        NSLog(@"%@",NSStringFromCGRect(rect));
        rect.size.width = rect.size.width;
        rect.origin.x=0;
        rect.origin.y-=120;
    }
    else 
    {
        NSLog(@"%@",NSStringFromCGRect(rect));

        rect.origin.x=60;
        rect.origin.y+=25;
        rect.size.width=600;
        rect.size.height=700;
    }




    defaultLayerHostingView = [(CPTGraphHostingView *)[CPTGraphHostingView alloc] initWithFrame:rect];
      defaultLayerHostingView.userInteractionEnabled=YES;
    defaultLayerHostingView.exclusiveTouch=YES;
    defaultLayerHostingView.multipleTouchEnabled=YES;
    defaultLayerHostingView.backgroundColor= [UIColor clearColor];
    //defaultLayerHostingView.delegate=self;

    [myScrollView addSubview:defaultLayerHostingView];
    myScrollView.delegate=self;


    CGRect bounds  = defaultLayerHostingView.bounds;
    graph  = [[CPTXYGraph alloc] initWithFrame:[defaultLayerHostingView bounds]];

    defaultLayerHostingView.hostedGraph = graph; 

    CPTMutableTextStyle *textStyle  = [CPTMutableTextStyle textStyle];//
    textStyle.color = [CPTColor grayColor];
    textStyle.fontName = @"Helvetica-Bold";
    textStyle.fontSize = bounds.size.height / 20.0f;
    graph.titleTextStyle = textStyle;
    graph.titleDisplacement = CGPointMake(0.0f, bounds.size.height / 18.0f);
    graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop;
    graph.plotAreaFrame.masksToBorder = NO;

    // Graph padding
    CGFloat boundsPadding = bounds.size.width / 20.0f;
    NSLog(@"the bounds padding is %f",boundsPadding);
    graph.paddingLeft = boundsPadding;
    graph.paddingTop = graph.titleDisplacement.y * 2;
    graph.paddingRight = 32;
    graph.paddingBottom = boundsPadding;
    graph.axisSet = nil;

    // Add pie chart

     CPTPieChart *piePlot = [[CPTPieChart alloc] init];

    piePlot.dataSource = self;
    piePlot.title=@"First";


    piePlot.pieRadius=200;
    piePlot.startAngle = M_PI_4;
    piePlot.sliceDirection = CPTPieDirectionCounterClockwise;
    piePlot.overlayFill = [CPTFill fillWithGradient:overlayGradient];
    piePlot.delegate = self;
    [graph addPlot:piePlot];

    [piePlot release];

    CPTLegend *theLegend = [CPTLegend legendWithGraph:graph];
    theLegend.numberOfColumns = 2;
    theLegend.fill = [CPTFill fillWithColor:(CPTColor *)[UIColor clearColor]];
    theLegend.cornerRadius = 5.0;
    theLegend.swatchSize=CGSizeMake(25, 25);
    theLegend.textStyle=textStyle1;
    graph.legend = theLegend;
    graph.legendAnchor =CPTRectAnchorCenter;


    graph.legendDisplacement=CGPointMake(-10, -275);

    UIButton *ProceedButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [ProceedButton setImage:[UIImage imageNamed:@"details_button_land.png"] forState:UIControlStateNormal];
    [ProceedButton setUserInteractionEnabled:YES];

    [myScrollView  addSubview:claimsProceedButton];
    ProceedButton.tag=0;
    if(currentOrientation   == UIInterfaceOrientationPortrait || currentOrientation== UIInterfaceOrientationPortraitUpsideDown)
    {


        [ProceedButton setFrame:CGRectMake((myScrollView.frame.size.width-300)/2, 720, 300.00 , 51.00)];
    }
    else{
        [ProceedButton setFrame:CGRectMake((myScrollView.frame.size.width-300)/2, 690, 300.00 , 51.00)];
    }


    rect=self.view.bounds;
    [ProceedButton addTarget:self action:@selector(ProceedDetail:) forControlEvents:UIControlEventTouchUpInside];
    UILabel *viewDetails = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300.00, 51.00)];
    [ProceedButton addSubview:viewDetails];
    [viewDetails setText:@"View Chart Data"];
    [viewDetails setFont:[UIFont boldSystemFontOfSize:13]];
    [viewDetails setBackgroundColor:[UIColor clearColor]];
    [viewDetails setTextAlignment:UITextAlignmentCenter];

    NSLog(@"%@",NSStringFromCGRect(rect));

    rect=self.view.bounds;

    defaultLayerHostingView=nil;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:09:55+00:00Added an answer on June 13, 2026 at 1:09 pm

    You can replace the existing code to this

        - (void)ipadDraw
    

    {

    CPTGradient *overlayGradient = [[[CPTGradient alloc] init] autorelease];
    overlayGradient.gradientType = CPTGradientTypeRadial;
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.0] atPosition:0.0];
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor]
    overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.5] atPosition:0.9];
    enter code here   overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.8] atPosition:1.0];
    
    CGRect rect=self.view.bounds;if(currentOrientation==UIInterfaceOrientationPortrait || currentOrientation== UIInterfaceOrientationPortraitUpsideDown)
      { NSLog(@"%@",NSStringFromCGRect(rect));
    
    
    
    rect.size.width = rect.size.width;
    rect.origin.x=0;
    rect.origin.y-=120;
    }
    
    else { 
     NSLog(@"%@",NSStringFromCGRect(rect)); 
    rect.origin.x=60;
    rect.origin.y+=25;
    rect.size.width=600;
    rect.size.height=700;
    }
    
    defaultLayerHostingView = [[(CPTGraphHostingView *)[CPTGraphHostingView alloc] initWithFrame:rect]autorelease];
    defaultLayerHostingView.userInteractionEnabled=YES;
    defaultLayerHostingView.exclusiveTouch=YES;
    defaultLayerHostingView.multipleTouchEnabled=YES;
    defaultLayerHostingView.backgroundColor= [UIColor clearColor];
    [myScrollView addSubview:defaultLayerHostingView];
    myScrollView.delegate=self;
    CGRect bounds  = defaultLayerHostingView.bounds;
    graph  = [[[CPTXYGraph alloc] initWithFrame:[defaultLayerHostingView bounds]]autorlease];
    defaultLayerHostingView.hostedGraph = graph; 
    
    CPTMutableTextStyle *textStyle  = [CPTMutableTextStyle textStyle];//
    textStyle.color = [CPTColor grayColor];
    textStyle.fontName = @"Helvetica-Bold";
    textStyle.fontSize = bounds.size.height / 20.0f;
    graph.titleTextStyle = textStyle;
    graph.titleDisplacement = CGPointMake(0.0f, bounds.size.height / 18.0f);
    graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop;
    graph.plotAreaFrame.masksToBorder = NO;
    
    // Graph padding
    CGFloat boundsPadding = bounds.size.width / 20.0f;
    NSLog(@"the bounds padding is %f",boundsPadding);
    graph.paddingLeft = boundsPadding;
    graph.paddingTop = graph.titleDisplacement.y * 2;
    graph.paddingRight = 32;
    graph.paddingBottom = boundsPadding;
    graph.axisSet = nil;
    
    // Add pie chart
    
     CPTPieChart *piePlot = [[[CPTPieChart alloc] init]autorelease];
    
    piePlot.dataSource = self;
    piePlot.title=@"First";
    
    
    piePlot.pieRadius=200;
    piePlot.startAngle = M_PI_4;
    piePlot.sliceDirection = CPTPieDirectionCounterClockwise;
    piePlot.overlayFill = [CPTFill fillWithGradient:overlayGradient];
    piePlot.delegate = self;
    [graph addPlot:piePlot];
    
    [piePlot release];
    
    CPTLegend *theLegend = [CPTLegend legendWithGraph:graph]autorlease];
    theLegend.numberOfColumns = 2;
    theLegend.fill = [CPTFill fillWithColor:(CPTColor *)[UIColor clearColor]];
    theLegend.cornerRadius = 5.0;
    theLegend.swatchSize=CGSizeMake(25, 25);
    theLegend.textStyle=textStyle1;
    graph.legend = theLegend;
    graph.legendAnchor =CPTRectAnchorCenter;
    
    
    graph.legendDisplacement=CGPointMake(-10, -275);
    
    UIButton *ProceedButton = [[UIButton buttonWithType:UIButtonTypeCustom];
    [ProceedButton setImage:[UIImage imageNamed:@"details_button_land.png"] forState:UIControlStateNormal]autorelease];
    [ProceedButton setUserInteractionEnabled:YES];
    
    [myScrollView  addSubview:claimsProceedButton];
    ProceedButton.tag=0;
    if(currentOrientation   == UIInterfaceOrientationPortrait || currentOrientation== UIInterfaceOrientationPortraitUpsideDown)
    {
    
    
        [ProceedButton setFrame:CGRectMake((myScrollView.frame.size.width-300)/2, 720, 300.00 , 51.00)];
    }
    else{
        [ProceedButton setFrame:CGRectMake((myScrollView.frame.size.width-300)/2, 690, 300.00 , 51.00)];
    }
    
    
    rect=self.view.bounds;
    [ProceedButton addTarget:self action:@selector(ProceedDetail:) forControlEvents:UIControlEventTouchUpInside];
    UILabel *viewDetails = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300.00, 51.00)];
    [ProceedButton addSubview:viewDetails];
    [viewDetails setText:@"View Chart Data"];
    [viewDetails setFont:[UIFont boldSystemFontOfSize:13]];
    [viewDetails setBackgroundColor:[UIColor clearColor]];
    [viewDetails setTextAlignment:UITextAlignmentCenter];
    
    NSLog(@"%@",NSStringFromCGRect(rect));
    
    rect=self.view.bounds;
    
    defaultLayerHostingView=nil;
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm trying to create some graphs using Core Plot, but for the following
i am using core plot to draw pie chart and following text Error 10
I'm using Core Plot to develop some iOS applications, but zooming and panning seems
I'm using Core-Plot to visualize temperature values over time. This works fine with one
I'm using core plot to create a small plot in one of my view
I have slider in one view and Bar chart using core plot in its
I've been using Core Plot to draw some charts for an iOS app I've
I'm using Core Plot to do some graphing in an iOS app. I'm in
Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
I'm using Core Plot to display a scatter plot graph, and I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.