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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:26:07+00:00 2026-06-05T01:26:07+00:00

I have to draw multiple graphs .I have to consider one Y Values to

  • 0

I have to draw multiple graphs .I have to consider one Y Values to red, blue graphs and Y2 Axis values for green graph.I am using core plat library ……I done something like below and getting graph like below image .But i need set different values for y and y2.enter image description here I am not getting how to draw…please help me…

CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(self.xRangeMinVal) length:CPTDecimalFromInt(self.xRangeMaxVal)];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(self.yRangeMinVal) length:CPTDecimalFromInt(self.yRangeMaxVal)];
    //plotSpace.allowsUserInteraction = YES;
    //plotSpace.delegate = self;

    // Grid line styles
    CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle];
    majorGridLineStyle.lineWidth = 0.75;
    majorGridLineStyle.dashPattern = [NSArray arrayWithObjects:[NSNumber numberWithFloat:2.0f], nil];
    majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.4] colorWithAlphaComponent:0.4];
    CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle];
    minorGridLineStyle.lineWidth = 0.25;
    minorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.4] colorWithAlphaComponent:0.1];    

    CPTMutableTextStyle *textStyle = [CPTTextStyle textStyle];
    textStyle.color                   = [CPTColor blackColor];
    textStyle.fontSize                = 16.0f;
    textStyle.textAlignment           = CPTTextAlignmentCenter;


    CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
    axisLineStyle.lineWidth = 3.0;
    axisLineStyle.lineCap   = kCGLineCapRound;
    // Axes
    // Label x axis with a fixed interval policy
    CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet;
    CPTXYAxis *x = axisSet.xAxis;
    x.majorIntervalLength = CPTDecimalFromString(@"2.0");
    x.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0.0");
    x.minorTicksPerInterval = 1;
    x.majorGridLineStyle = majorGridLineStyle;
    x.minorGridLineStyle = minorGridLineStyle;
    //x.preferredNumberOfMajorTicks=;

    x.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
    //x.title = [NSString stringWithFormat:@"goat"];
    //x.titleOffset = 10.0;
    //x.titleLocation = CPTDecimalFromString(@"0.0");
    x.title = self.xLineTitle;
    x.axisLineStyle            = axisLineStyle;
    x.titleTextStyle = textStyle;

    CPTMutableLineStyle *dottedStyle=[CPTMutableLineStyle lineStyle];


    x.minorGridLineStyle=dottedStyle;

    // Label y with an automatic label policy. 
    CPTXYAxis *y = axisSet.yAxis;
    y.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
   // y.orthogonalCoordinateDecimal = CPTDecimalFromString(@"-10.0");
    y.minorTicksPerInterval = 2;
    y.preferredNumberOfMajorTicks = 8;
    y.majorGridLineStyle = majorGridLineStyle;
    y.minorGridLineStyle = minorGridLineStyle;
    //y.labelOffset = 1.0;
    y.title = self.yLineTitle;
    y.titleTextStyle = textStyle;
    y.axisLineStyle            = axisLineStyle;
    y.titleRotation = M_PI * 0.5;
    y.minorGridLineStyle=dottedStyle;


    CPTXYPlotSpace *plotSpace1 = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
   // CPTXYPlotSpace *plotSpace1 = [[[CPTXYPlotSpace alloc] init] autorelease];
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(self.xRangeMinVal) length:CPTDecimalFromInt(self.xRangeMaxVal)];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(60)];
    CPTXYAxis *y2 = [[[CPTXYAxis alloc] init] autorelease];
    y2.coordinate                  = CPTCoordinateY;
    y2.plotSpace                   = plotSpace1;
    y2.majorGridLineStyle          = majorGridLineStyle;
    y2.minorGridLineStyle          = minorGridLineStyle;
    y2.orthogonalCoordinateDecimal = CPTDecimalFromDouble(self.xRangeMaxVal);
    y2.labelingPolicy              = CPTAxisLabelingPolicyAutomatic;
    //y2.separateLayers            = NO;
    y2.preferredNumberOfMajorTicks = 7;
    y2.minorTicksPerInterval       = 2;//
    y2.tickDirection               = CPTSignPositive;
    y2.axisLineStyle               = axisLineStyle;
    //y2.majorTickLength               = 6.0;
    y2.majorTickLineStyle          = axisLineStyle;
    //y2.minorTickLength               = 4.0;
    y2.title                       = @"Y2 Axis";
    //y2.titleTextStyle            = axisTitleTextStyle;
    y2.titleOffset                 = 40.0;

    //graph.axisSet.axes = [NSArray arrayWithObjects:x, y, y2, nil];
    self.graph.axisSet.axes = [NSArray arrayWithObjects:x, y,y2,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-05T01:26:09+00:00Added an answer on June 5, 2026 at 1:26 am

    Sorry you can’t add multiple x or y axis in one plot space.

    so whatever you want to do is just make dynamic y or x-axis in your plot.

    Just calculate that there is maximum value of y-axis is this and for x-axis this.

    but you must have to use only one y-axis and x-axis for same plot space.

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

Sidebar

Related Questions

I have a vector drawing app where users can draw lines using multiple quadratic
I have to design a GUI using Qt. I would like to draw multiple
I have tried to draw Polygon using Drawing Manager and send the Polygon Coordinates
I'm using http://raphaeljs.com/ to try and draw multiple small circles. The problem I'm having
How can i generate multiple texts using the imagecreatetruecolor() method? I have the following
I have to draw a bitmap multiple times. It's loaded from file. I can
I have been trying to draw multiple balls for a game I am making,
Using C# and ASP.NET, I need my gridview to draw columns from multiple tables.
I have an NSView containing multiple subviews. One of those subviews is transparent and
I want to add multiple columns in UITableView. I have created one CustomeTableCell with

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.