Alex Rivera | Logout

How to implement bar chart in iPhone?

Asked 2012-09-08T11:52:09.760
9

I am working in simple bar chart application, Using Coreplot to develop this application, then i try to implement the bar chart but i get the issue found in

  [__NSCFConstantString sizeWithTextStyle:]: unrecognized selector sent to instance 0x7fb4c'
   First throw call stack:

How to fix this? please help me

Thanks in Advance

I tried this:

Viewcontroller.h

#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"


@interface GraphViewController : UIViewController <CPTPlotDataSource>
{
    CPTXYGraph *barChart;
    NSTimer *timer;
    NSMutableArray *samples;
}

-(void) getGraphValues;

@end

Viewcontroller.m

 - (void)viewDidLoad
    {
        [super viewDidLoad];

        self.view.backgroundColor=[UIColor whiteColor];
        self.title = @"Sample";
        self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
        [self.navigationController setNavigationBarHidden:NO];

        [self getGraphValues];

        double xAxisLength = [samples count];

        barChart = [[CPTXYGraph alloc] initWithFrame:CGRectMake(0, 0, 320, 380)];

        barChart.plotAreaFrame.borderLineStyle = nil;
        barChart.plotAreaFrame.cornerRadius = 0.0f;

        barChart.paddingLeft = 0.0f;
        barChart.paddingRight = 0.0f;
        barChart.paddingTop = 0.0f;
        barChart.paddingBottom = 0.0f;

        barChart.plotAreaFrame.paddingLeft = 60.0;
        barChart.plotAreaFrame.paddingTop = 40.0;
        barChart.plotAreaFrame.paddingRight = 10.0;
        barChart.plotAreaFrame.paddingBottom = 40.0;

        barChart.title = @"Sample Innovations";

        CPTMutableTextStyle *textStyle = [CPTTextStyle textStyle];
        textStyle.color = [CPTColor grayColor];
        textStyle.fontSize = 16.0f;
        textStyle.textAlignment = CPTTextAlignmentCenter;
        barChart.titleTextSty
Edit
Report

1 Answer

10

As Eric has explained, you need to se the -all_load flag in the build settings. In case you are wondering where this exactly is have a look at this picture. Good luck!

Setting the all_add flag on XCode

answered 2012-10-20T08:44:31.707

Your Answer