Coder Social home page Coder Social logo

dynamicgraphview's Introduction

DynamicGraphView

A simple but effective dynamic GraphView implementation for iPhone SDK for float values.

The left image shows a graph with only positive values and without curved lines. The right graph draws from positve and negative values and has the option for curved lines activated.

Screenshot-----Screenshot

Implementing this control into your project is very easy.

#####1) Copy both GraphView.h and GraphView.m into your projet resources.

#####2) In your ViewController.h:

import <UIKit/UIKit.h>
import "GraphView.h"


@interface ViewController : UIViewController <UITextFieldDelegate> {

GraphView *graphView;

}

@property (strong, nonatomic) GraphView *graphView;

@end

#####3) In your ViewController.m:

- (void)viewDidLoad 
{
graphView = [[GraphView alloc]initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, 180)];
[graphView setBackgroundColor:[UIColor yellowColor]];
[graphView setSpacing:10];
[graphView setFill:YES];
[graphView setStrokeColor:[UIColor redColor]];
[graphView setZeroLineStrokeColor:[UIColor greenColor]];
[graphView setFillColor:[UIColor orangeColor]];
[graphView setLineWidth:2];
[graphView setCurvedLines:YES];
[self.view addSubview:graphView];
}

Done!

#####To control the graph, use following functions:

  1. This will display a graph of float values:

    [graphView setArray:(NSArray)]

  2. This will add a point to the graph. You can add as many as you like and even do this dynamically. The graph will update every time a new value has been added:

    [graphView setPoint:(float)]

  3. This will reset the graph to all 0 values:

    [graphView resetGraph]

  4. This sets the number of values displayed in the graph:

    [graphView setNumberOfPointsInGraph:(int)]

  5. This will make the space beneth the graph line fill or not:

    [graphView setFill:(BOOL)]

Thats all!

If you have any more question, please read the comments in GraphView.h and GraphView.m or send me a message.

Please concider the MIT License agreement.

dynamicgraphview's People

Contributors

freshking avatar mpashnyov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.