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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:00:00+00:00 2026-06-04T01:00:00+00:00

I am using EASYGRAPH for to create graph in iphone app problem is that

  • 0

I am using EASYGRAPH for to create graph in iphone app problem is that it gets static values and shows graph i want that values should be dynamic come from view controller for this graph.

UIView For Graph

 #import <UIKit/UIKit.h>
 #import "ECGraph.h"
 #import "ECGraphItem.h"
@class GraphsViewController;
@interface Display : UIView {

NSArray *percentages;



}

 @property(nonatomic,retain)NSArray*percentages;


 -(void) setPercentageArray:(NSArray*) array;

@end


  #import "Display.h"
  #import "ECGraph.h"
  @implementation Display
  @synthesize percentages;

 - (id)initWithFrame:(CGRect)frame {

  self = [super initWithFrame:frame];
  if (self) {
    // Initialization code.
  }
  return self;
  }


   - (void)drawRect:(CGRect)rect {


CGContextRef _context = UIGraphicsGetCurrentContext();
ECGraph *graph = [[ECGraph alloc] initWithFrame:CGRectMake(300,500,320,200) withContext:_context isPortrait:NO];



//300,500,320, 200

ECGraphItem *item1 = [[ECGraphItem alloc] init];

ECGraphItem *item2 = [[ECGraphItem alloc] init];    
item1.isPercentage = YES;
item1.yValue=80;
item1.width = 35;
item1.name = @"item1";
item2.isPercentage = YES;
item2.yValue =17;
item2.width = 35; 
item2.name = @"item2";




NSArray *items = [[NSArray alloc] initWithObjects:item1,item2,nil];

[graph setXaxisTitle:@"name"];
[graph setYaxisTitle:@"Percentage"];
[graph setGraphicTitle:@"Histogram"];
[graph setDelegate:self];
[graph setBackgroundColor:[UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1]];



[graph drawHistogramWithItems:items lineWidth:2 color:[UIColor blackColor]];




 }
  • 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-04T01:00:01+00:00Added an answer on June 4, 2026 at 1:00 am

    First make a class that contains two properties width and height. then add it to array using addObject. now each object has individual values of height and width.

    then use this

    for(Item* theObj in arrayItems)
    {//arrayItems is the array in which you have added the objects height and width
      ECGraphItem *tempItem = [[ECGraphItem alloc] init];    
      tempItem.isPercentage = YES;
      tempItem.yValue=theObj.height;
      tempItem.width = theObj.widht;
      tempItem.name = [NSString stringWithFormat@"Item: %d",/*set some number here*/];
    
      [items addObject:tempItem];
    }
    

    and then pass it to graph

    [graph drawHistogramWithItems:items lineWidth:2 color:[UIColor blackColor]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using Nunit, I want to be able to write a test fixture that will
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using Android 2.1+. I have a service that gets killed from time to time
Using Yii, I want to delete all the rows that are not from today.
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using PHP, I can convert MySQL data or static table data to csv, Excel,
Using top it's easy to identify processes that are hogging memory and cpu, but
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using mercurial, I've run into an odd problem where a line from one committer

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.