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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:52:10+00:00 2026-05-31T01:52:10+00:00

I am plotting a graph using Core-Plot. When i use following code for x-axis

  • 0

I am plotting a graph using “Core-Plot”. When i use following code for x-axis then it works fine.

            axisSet.xAxis.titleTextStyle = textStyle;
            axisSet.xAxis.titleOffset = 2.0f;
            axisSet.xAxis.axisLineStyle = axisLineStyle;
            axisSet.xAxis.majorTickLineStyle = axisLineStyle;
            axisSet.xAxis.minorTickLineStyle = axisLineStyle;
            axisSet.xAxis.labelTextStyle = textStyle;
            axisSet.xAxis.labelOffset = 0.0f;
            axisSet.xAxis.minorTicksPerInterval = 1;
            axisSet.xAxis.minorTickLength = 0.0f;
            axisSet.xAxis.majorTickLength = 5.0f;

            plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat(7.0f)];
            axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(1.0f);

But when i use code like this:

//————————————————————————–

    NSArray *arr;
    NSString *month;
    NSString *days;

    NSDateFormatter *format=[[NSDateFormatter alloc]init];
    [format  setDateFormat:@"yyyy/MM/dd"];

    NSDate *day=[NSDate date];
    NSDate *week  = [day dateByAddingTimeInterval: -604800.0];
    NSDate *day1  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:week];
    NSDate *day2  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day1];
    NSDate *day3  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day2];
    NSDate *day4  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day3];
    NSDate *day5  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day4];
    NSDate *day6  = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day5];
    NSDate *today = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:day6];

    NSString *str1  =[format stringFromDate:day1];
    arr=[str1 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str1=[days stringByAppendingFormat:@":%@",month];

    NSString *str2  =[format stringFromDate:day2];
    arr=[str2 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str2=[days stringByAppendingFormat:@":%@",month];


    NSString *str3  =[format stringFromDate:day3];
    arr=[str3 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str3=[days stringByAppendingFormat:@":%@",month];

    NSString *str4  =[format stringFromDate:day4];
    arr=[str4 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str4=[days stringByAppendingFormat:@":%@",month];

    NSString *str5  =[format stringFromDate:day5];
    arr=[str5 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str5=[days stringByAppendingFormat:@":%@",month];


    NSString *str6  =[format stringFromDate:day6];
    arr=[str6 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str6=[days stringByAppendingFormat:@":%@",month];


    NSString *str7  =[format stringFromDate:today];
    arr=[str7 componentsSeparatedByString:@"/"];
    month=[arr objectAtIndex:1];
    days=[arr objectAtIndex:2];
    str7=[days stringByAppendingFormat:@":%@",month];
    //--------------------------------------------------------------------------------

    axisSet.xAxis.title=@"-----One Week----->";
    axisSet.xAxis.titleTextStyle =textStyle;
    axisSet.xAxis.titleOffset = 10.0f;
    axisSet.xAxis.axisLineStyle = axisLineStyle;
    axisSet.xAxis.labelTextStyle = mtextStyle;
    axisSet.xAxis.labelOffset = 0.0f;
    axisSet.xAxis.majorTickLength = 1.0f;

    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0)   length:CPTDecimalFromFloat(7)];
    axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(1.0f);

    //--------------labeling X-axis------------------------------------------

    axisSet.xAxis.labelRotation = M_PI/4;
    axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyNone;
    NSArray *customTickLocations = [NSArray arrayWithObjects:
                                    [NSDecimalNumber numberWithInt:1], 
                                    [NSDecimalNumber numberWithInt:2], 
                                    [NSDecimalNumber numberWithInt:3], 
                                    [NSDecimalNumber numberWithInt:4],
                                    [NSDecimalNumber numberWithInt:5],
                                    [NSDecimalNumber numberWithInt:6],
                                    [NSDecimalNumber numberWithInt:7],nil];
    NSArray *xAxisLabels = [NSArray arrayWithObjects:str1,str2,str3,str4,str5,str6,str7,nil];
    NSUInteger labelLocation = 0;
    NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[xAxisLabels count]];

    for (NSNumber *tickLocation in customTickLocations) 
    {
        CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [xAxisLabels objectAtIndex:labelLocation++] textStyle:axisSet.xAxis.labelTextStyle];
        newLabel.tickLocation = [tickLocation decimalValue];
        newLabel.offset = axisSet.xAxis.labelOffset + axisSet.xAxis.majorTickLength;
        [customLabels addObject:newLabel];
        [newLabel release];
    }
    axisSet.xAxis.axisLabels =  [NSSet setWithArray:customLabels];
    //--------------------------------------------------------------------------- 

Then tick marks on x-axis disaapears. I searched everywhere but unable to find relevant answer. So please if anyone can do it then tell me. Thanks in advance !!

  • 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-05-31T01:52:11+00:00Added an answer on May 31, 2026 at 1:52 am

    The CPTAxisLabelingPolicyNone labeling policy requires you to provide the tick locations separately. This allows maximum flexibility in labeling—you don’t have to label every tick and you can place labels at locations that don’t have tick marks.

    axisSet.xAxis.majorTickLocations = [NSSet setWithArray:customTickLocations];
    

    If you want minor ticks, you’ll need to set the minorTickLocations, too.

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

Sidebar

Related Questions

I am plotting a bar graph using core plot for both positive and negative
I am working in a graph using the great framework core-plot (in desktop OSX).
I'm using the core-plot library to do some plotting, and would like to implement
I have trouble with using the Core-Plot library in MonoTouch. I use this as
I am plotting 20 different lines on a single plot using matplotlib. I use
I have a requirement to Plot a graph with zoom feature using x axis
Hi probably quite a simple question but.. When plotting a graph using matplotlib.pyplot my
Hi i'm plotting columnseries graph using chart controls by downloading Microsoft wpftoolkit. I can
I want to make a scatter plot using matplotlib. If I want to use
I've a running graph library developed with onDraw plotting the graph using canvas.drawLine methods.

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.