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 7905803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:38:44+00:00 2026-06-03T10:38:44+00:00

Am a newbie to Core Plot & to iOS/Cocoa. I have a view from

  • 0

Am a newbie to Core Plot & to iOS/Cocoa. I have a view from which am calling another view (called MyGraphView) which has the CorePlot graph.

The MainView.h

@interface MainView : UIViewController {
…
}

MainView.m

 ....
 ....
 @implementation MyView
 ....
 MyGraphView *myGraphView;
 ....
 ....
 // This gets called when a button's pressed. Once the button's pressed, 
 // I want to display the view which has the graph i.e. pie chart
 -(IBAction) toDateChosen:(id)sender {
   ....
    [self presentModalViewController:myGraphView animated:YES];
   ....
 }

 ....
 ....
 - (void)viewDidLoad {
    ...
    myGraphView = [[EmotionsHistoryView alloc] initWithNibName:nil bundle:nil];
    ....
 }

And in the MyGraphView.h

#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"

@interface MyGraphView : UIViewController <CPTPlotDataSource> {
  ....
  ....
  CPTXYGraph *graph;
  CPTPieChart *pieChart;
}

@property (nonatomic, retain) CPTXYGraph *graph;

-(void) initializeGraph;
-(void) initializePieChart;
....
....

In MyGraphView.m

....
@implementation MyGraphView
....
-(void) initializeGraph {

    graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];

    CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
    hostingView.hostedGraph = graph;  
    //hostingView.bounds = CGRectMake(5, 5, 70, 70);
    [self initializePieChart];
}
....
....
-(void) initializePieChart {

    pieChart = [[CPTPieChart alloc] initWithFrame:CGRectMake(25, 25, 50, 20)];
    pieChart.dataSource = self;
    pieChart.pieRadius = 100.0;
    pieChart.opaque = FALSE;
    pieChart.pieRadius = 60;
    pieChart.shadowOffset = CGSizeMake(-1, 1);
    pieChart.identifier = @"Identifier1";
    pieChart.startAngle = M_PI_4;
    pieChart.sliceDirection = CPTPieDirectionCounterClockwise;
    pieChart.labelOffset = -0.6;
    [graph addPlot:pieChart];
}
....
....

When this graph view is shown, I also want to show a button below the graph which will take the user to another screen. But I tried various ways to do it, in vain. I tried reducing the graph size using bounds for the frame of the view, in specifying it in ‘init’ for both the graph and pie chart, in vain. The graph seems to inevitably occupy the entire view. I also tried adding a button in the MyGraphView.xib file (in Interface Builder) but the button doesn’t show up when I run the App in iOS Simulator as the graph occupies the entire view/screen.

Any pointers please?
I use iOS 5.0 and Xcode 4.2, along with the iOS Simulator to run the App.

Thank you

  • 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-03T10:38:46+00:00Added an answer on June 3, 2026 at 10:38 am

    Don’t add the button as a subview of the hosting view. The flip transform used by Core Plot will flip the button, too. Instead, make both the hosting view and button subviews of another view. They can be positioned in the superview like any other views.

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

Sidebar

Related Questions

I have a newbie question! I have a problem coming back from a view
Am a newbie to iOS programming and to Core Plot. Am using XCode 4.2
I am a jQuery newbie. I have a core js file which will not
a newbie question I have a Django project with two applications core and nagios
I am a newbie and learning core data from scratch. I've got the coredatamodel
I am a cocoa newbie trying to create an iPhone app including Core Data.
I am an iOS development newbie. I want to delete a few rows from
Being a Django newbie, I have a question to ask, which should be very
I have the academic distribution of EPD 7.1 for MacOS 10.6.x , which has
I have a model called newbie. The routes.rb file looks like: Myapp::Application.routes.draw do resources

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.