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

  • SEARCH
  • Home
  • 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 8505843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:26:00+00:00 2026-06-11T02:26:00+00:00

Currently i am working on an iPad application,im Using Core-Plot to develop Bar chart

  • 0

Currently i am working on an iPad application,im Using Core-Plot to develop Bar chart in my iPhone application, then i have modified the frame size for iPad to import the same thing in iPad application, but the bar chart is showing up in small on the screen, but i want to show it full screen in iPad, How to fix this? please help me

Thanks in Advance

I tried this

iPhone

-(void) drawBarChart
{

        NSLog(@"iPhone Bar chart");

        double xAxisLength = [barValuesArray count];

        barGraph = [[CPTXYGraph alloc] initWithFrame:CGRectMake(0, 50, 320, 350)];

        barGraph.paddingLeft = 0.0f;
        barGraph.paddingRight = 0.0f;
        barGraph.paddingTop = 0.0f;
        barGraph.paddingBottom = 0.0f;

        barGraph.plotAreaFrame.paddingLeft = 60.0;
        barGraph.plotAreaFrame.paddingTop = 40.0;
        barGraph.plotAreaFrame.paddingRight = 10.0;
        barGraph.plotAreaFrame.paddingBottom = 40.0;

        if ([selectedName isEqualToString:@"(null)"] || [selectedName isEqualToString:@""] || [selectedName isEqualToString:@"NULL"] || selectedName == @"(null)" || selectedName == NULL || selectedName == @"null" || selectedName == nil) 
        {
            barGraph.title = [namesArray objectAtIndex:0];
        }
        else
        {
            barGraph.title = selectedName;
        }

        hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 10, 320, 400)];
        hostingView.hostedGraph = barGraph;

        CPTMutableTextStyle *textStyle = [CPTTextStyle textStyle];
        textStyle.color = [CPTColor blackColor];
        textStyle.fontSize = 16.0f;
        textStyle.textAlignment = CPTTextAlignmentCenter;
        barGraph.titleTextStyle = textStyle;
        barGraph.titleDisplacement = CGPointMake(0.0f, -10.0f);
        barGraph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; 


        CPTXYAxisSet *axisSet = (CPTXYAxisSet *)barGraph.axisSet;
        CPTXYAxis *x = axisSet.xAxis;
        //    x.axisLineStyle = nil;
        //    x.majorTickLineStyle = nil;
        //    x.minorTickLineStyle = nil;
        x.majorIntervalLength = CPTDecimalFromString(@"70");
        x.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0");
        x.title = @"Names";
        x.titleLocation = CPTDecimalFromFloat(7.5f);
        x.titleOffset = 50.0f; //25.0f;
        x.labelRotation = M_PI/5;
        x.labelingPolicy = CPTAxisLabelingPolicyNone;


        NSArray *customTickLocations = [NSArray arrayWithObjects: [NSDecimalNumber numberWithInt:1], [NSDecimalNumber numberWithInt: 5], [NSDecimalNumber numberWithInt:9], [NSDecimalNumber numberWithInt:13], nil];


        //    NSArray *xAxisLabels = [NSArray arrayWithObjects:@"Smoke", @"Nicotine", @"Tar", @"", nil];
        //    NSUInteger labelLocation = 0;
        //    
        //    NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[xAxisLabels count]];
        //    for (NSNumber *tickLocation in customTickLocations) 
        //    {
        //        CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [xAxisLabels objectAtIndex:labelLocation++] textStyle:x.labelTextStyle];
        //        newLabel.tickLocation = [tickLocation decimalValue];
        //        newLabel.offset = x.labelOffset + x.majorTickLength;
        //        newLabel.rotation = M_PI/xAxisLength;
        //        [customLabels addObject:newLabel];
        //        [newLabel release];
        //    }
        //    
        //    x.axisLabels =  [NSSet setWithArray:customLabels];

        CPTXYAxis *y = axisSet.yAxis;
        //    y.axisLineStyle = nil;
        //    y.majorTickLineStyle = nil;
        //    y.minorTickLineStyle = nil;
        y.majorIntervalLength = CPTDecimalFromString(@"100");
        y.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0");
        //    y.title = @"Work Status";
        //    y.titleOffset = 40.0f;
        //    y.titleLocation = CPTDecimalFromFloat(150.0f);


        CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) barGraph.defaultPlotSpace;
        plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0f) length:CPTDecimalFromDouble(15.0f)];
        plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0f) length:CPTDecimalFromDouble(1000.0f)];

        CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blueColor] horizontalBars:NO];
        barPlot.plotRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(13)];//xAxisLength
        barPlot.barOffset = CPTDecimalFromFloat(1.0f);
        barPlot.baseValue = CPTDecimalFromString(@"0");
        barPlot.barWidth = CPTDecimalFromFloat(3.0f);
        barPlot.cornerRadius = 2.0f;
        barPlot.dataSource = self;
        [barGraph addPlot:barPlot];

        [self.view addSubview:hostingView];

}

iPad Bar chart:

-(void) drawBarChart
{

        NSLog(@"iPAD");

        double xAxisLength = [barValuesArray count];


        barGraph = [[CPTXYGraph alloc] initWithFrame:CGRectMake(0, 50, 700, 1000)];

        barGraph.paddingLeft = 0.0f;
        barGraph.paddingRight = 0.0f;
        barGraph.paddingTop = 0.0f;
        barGraph.paddingBottom = 0.0f;

        barGraph.plotAreaFrame.paddingLeft = 60.0;
        barGraph.plotAreaFrame.paddingTop = 40.0;
        barGraph.plotAreaFrame.paddingRight = 10.0;
        barGraph.plotAreaFrame.paddingBottom = 40.0;

        if ([selectedName isEqualToString:@"(null)"] || [selectedName isEqualToString:@""] || [selectedName isEqualToString:@"NULL"] || selectedName == @"(null)" || selectedName == NULL || selectedName == @"null" || selectedName == nil) 
        {
            barGraph.title = [namesArray objectAtIndex:0];
        }
        else
        {
            barGraph.title = selectedName;
        }

        hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 10, 700, 1000)];
        hostingView.hostedGraph = barGraph;

        CPTMutableTextStyle *textStyle = [CPTTextStyle textStyle];
        textStyle.color = [CPTColor blackColor];
        textStyle.fontSize = 16.0f;
        textStyle.textAlignment = CPTTextAlignmentCenter;
        barGraph.titleTextStyle = textStyle;
        barGraph.titleDisplacement = CGPointMake(0.0f, -10.0f);
        barGraph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; 


        CPTXYAxisSet *axisSet = (CPTXYAxisSet *)barGraph.axisSet;
        CPTXYAxis *x = axisSet.xAxis;
        //    x.axisLineStyle = nil;
        //    x.majorTickLineStyle = nil;
        //    x.minorTickLineStyle = nil;
        x.majorIntervalLength = CPTDecimalFromString(@"70");
        x.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0");
        x.title = @"Names";
        x.titleLocation = CPTDecimalFromFloat(7.5f);
        x.titleOffset = 50.0f; //25.0f;
        x.labelRotation = M_PI/5;
        x.labelingPolicy = CPTAxisLabelingPolicyNone;


        NSArray *customTickLocations = [NSArray arrayWithObjects: [NSDecimalNumber numberWithInt:1], [NSDecimalNumber numberWithInt: 5], [NSDecimalNumber numberWithInt:9], [NSDecimalNumber numberWithInt:13], nil];


        //    NSArray *xAxisLabels = [NSArray arrayWithObjects:@"Smoke", @"Nicotine", @"Tar", @"", nil];
        //    NSUInteger labelLocation = 0;
        //    
        //    NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[xAxisLabels count]];
        //    for (NSNumber *tickLocation in customTickLocations) 
        //    {
        //        CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [xAxisLabels objectAtIndex:labelLocation++] textStyle:x.labelTextStyle];
        //        newLabel.tickLocation = [tickLocation decimalValue];
        //        newLabel.offset = x.labelOffset + x.majorTickLength;
        //        newLabel.rotation = M_PI/xAxisLength;
        //        [customLabels addObject:newLabel];
        //        [newLabel release];
        //    }
        //    
        //    x.axisLabels =  [NSSet setWithArray:customLabels];

        CPTXYAxis *y = axisSet.yAxis;
        //    y.axisLineStyle = nil;
        //    y.majorTickLineStyle = nil;
        //    y.minorTickLineStyle = nil;
        y.majorIntervalLength = CPTDecimalFromString(@"100");
        y.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0");
        //    y.title = @"Work Status";
        //    y.titleOffset = 40.0f;
        //    y.titleLocation = CPTDecimalFromFloat(150.0f);


        CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) barGraph.defaultPlotSpace;
        plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0f) length:CPTDecimalFromDouble(15.0f)];
        plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0f) length:CPTDecimalFromDouble(1000.0f)];

        CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blueColor] horizontalBars:NO];
        barPlot.plotRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(13)];//xAxisLength
        barPlot.barOffset = CPTDecimalFromFloat(1.0f);
        barPlot.baseValue = CPTDecimalFromString(@"0");
        barPlot.barWidth = CPTDecimalFromFloat(3.0f);
        barPlot.cornerRadius = 2.0f;
        barPlot.dataSource = self;
        [barGraph addPlot:barPlot];

        [self.view addSubview:hostingView];
}

enter image description here

  • 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-11T02:26:02+00:00Added an answer on June 11, 2026 at 2:26 am

    just try this way may be helped you :

    CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(10, 70, 768, 1004)];
        hostingView.tag=1;
        [self.view addSubview:hostingView];
    //  [hostingView addSubview:OptionBtn];
        barChart = [[CPXYGraph alloc] initWithFrame:self.view.bounds];
        //barChart.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"FinalGraph.png"]];
        hostingView.hostedGraph = barChart;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently i am working on a Location based application for iPhone/iPad . I have
I'm currently listening and watching to iPad / iPhone application development and working assignments/demo.
I have a universal binary application and currently working on the iPad version of
We are currently working on an iPad application which will have the following functionality:
i am currently working on an iPad application, my client wants to add Function
I am working with the UISplitViewController in iPad application. Currently, I found two issues:
Solved Hey all, I'm currently working on a Split-View Based Application for iPad. I
I am working on an iPad application. In this I have to show some
I'm currently working on an iPad JS/HTML app, using native scrolling to view a
I have a drawing application that I'm working on for the iPad. I'm trying

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.