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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:19:44+00:00 2026-05-27T04:19:44+00:00

The context is that I am trying to plot a series of temperatures as

  • 0

The context is that I am trying to plot a series of temperatures as a graph.

At the moment my application works as follows (as i understand it):

The application opens, openfile is used which initialises my document class this reads the modified csv file into an NSString “fileContents” which I then separate into an array of strings, each string containing the value without separaters or whitespace. As follows:

NSArray *temps = [fileContents componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"\n|\r"]];

After that I initialise my custom view, the TemperatureGraph class, and immediately pass it the array which becomes the currentlog seen in the code below. Instance id is current.

Finally I invoke:

[current drawpath];

Which is the instance method below:

- (void) drawpath
{
    NSBezierPath *program = [NSBezierPath bezierPath];
    NSPoint st = NSMakePoint(0, 0);

    [program moveToPoint:st];
    [program setLineWidth:10];
    [program setLineCapStyle:NSRoundLineCapStyle];
    [[NSColor blueColor] setStroke];
    [program stroke];

    NSUInteger a, b;
    a = [currentlog count];
    b = 0;
    while (b <= a) {
        NSPoint new;
        float x;
        x = 5 * b;

        new = NSMakePoint(x, [[currentlog objectAtIndex:b] floatValue]);
        [program lineToPoint:new];
        [program stroke];
        b += 6;
    }
}

Why won’t it work? Definition of won’t work: Application compiles and runs but I have a blank window.

Also please point out any rookie errors that are in there but don’t affect code, as I am still in the learning stages 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-05-27T04:19:45+00:00Added an answer on May 27, 2026 at 4:19 am

    Drawing doesn’t happen unless you have an active graphics context. I’m assuming the drawpath method above is inside an NSView subclass – well in there you need to override a method called drawRect: – it may even have been added in as a stub when you made the subclass?

    Cocoa calls this method when it is time for the view to draw itself. This means that, when it is being called, a graphics context will be set up and and drawing code you do will actually appear on the screen.

    Simply call your drawpath method from inside drawRect: and you should see your lines.

    The general point to remember is that you don’t call any drawing code yourself (except from within drawRect:– you either mark a view as needing display ([myView setNeedsDisplay:YES];, or let the system do that itself.

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

Sidebar

Related Questions

I'm working on a project that is trying to use context-free grammars for parsing
I'm building a series of WCF Services that are going to be used by
I'm trying to plot some cities on Google's Geochart. This function works perfectly fine
I'll begin with a context that will lead to the actual question. I'm trying
I am trying to implement a context system similar to the one used by
I am trying to save a new Object to my context, that will have
I'm trying to create a context menu that changes the available options depending on
I'm trying to to have a context menu that allows the user to select
I have been trying to add a scroller to my context section that will
I am trying to create an application bootstrap that will drop all the tables

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.