this core plot code is working on iphone but not on ipad

This core plot is created from : . I have created 2 app with the same code, one for iPhone and another for iPad.The iphone app works perfectly but the ipad app displays x-coordinates and y-coordinated along with the title not the columns I don’t have any idea how to fix it.Please help me.It would be a great help.Using Xcode 4.5.2 ios6 .Thanks in Advance.


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

@interface BarPlotViewController : UIViewController
<CPTBarPlotDataSource, CPTBarPlotDelegate>

@property (nonatomic, retain) NSMutableArray *data;
@property (nonatomic, retain) CPTGraphHostingView *hostingView;
@property (nonatomic, retain) CPTXYGraph *graph;

- (void) generateBarPlot;



#import "BarPlotViewController.h"

@interface BarPlotViewController ()


@implementation BarPlotViewController

#define COLOR @"COLOR"

#define AXIS_START 0
#define AXIS_END 50

@synthesize data;
@synthesize graph;
@synthesize hostingView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) { = [NSMutableArray array];

        int bar_heights[] = {20,30,10,40};
        UIColor *colors[] = {
            [UIColor redColor],
            [UIColor blueColor],
            [UIColor orangeColor],
            [UIColor purpleColor]};
        NSString *categories[] = {@"Plain Milk", @"Milk + Caramel", @"White", @"Dark"};

        for (int i = 0; i < 4 ; i++){
            double position = i*10; //Bars will be 10 pts away from each other
            double height = bar_heights[i];

            NSDictionary *bar = [NSDictionary dictionaryWithObjectsAndKeys:
                                 [NSNumber numberWithDouble:position],BAR_POSITION,
                                 [NSNumber numberWithDouble:height],BAR_HEIGHT,
            [ addObject:bar];

        [self generateBarPlot];
    return self;

- (void)generateBarPlot
    //Create host view
    self.hostingView = [[CPTGraphHostingView alloc]
                        initWithFrame:[[UIScreen mainScreen]bounds]];
    [self.view addSubview:self.hostingView];

    //Create graph and set it as host view's graph
    self.graph = [[CPTXYGraph alloc] initWithFrame:self.hostingView.bounds];
    [self.hostingView setHostedGraph:self.graph];

    //set graph padding and theme
    self.graph.plotAreaFrame.paddingTop = 20.0f;
    self.graph.plotAreaFrame.paddingRight = 20.0f;
    self.graph.plotAreaFrame.paddingBottom = 70.0f;
    self.graph.plotAreaFrame.paddingLeft = 70.0f;
    [self.graph applyTheme:[CPTTheme themeNamed:kCPTDarkGradientTheme]];

    //set axes ranges
    CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:
                                                    length:CPTDecimalFromFloat((AXIS_END - AXIS_START)+5)];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:
                                                    length:CPTDecimalFromFloat((AXIS_END - AXIS_START)+5)];

    CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet;
    //set axes' title, labels and their text styles
    CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
    textStyle.fontName = @"Helvetica";
    textStyle.fontSize = 14;
    textStyle.color = [CPTColor whiteColor];
    axisSet.xAxis.title = @"CHOCOLATE";
    axisSet.yAxis.title = @"AWESOMENESS";
    axisSet.xAxis.titleTextStyle = textStyle;
    axisSet.yAxis.titleTextStyle = textStyle;
    axisSet.xAxis.titleOffset = 30.0f;
    axisSet.yAxis.titleOffset = 40.0f;
    axisSet.xAxis.labelTextStyle = textStyle;
    axisSet.xAxis.labelOffset = 3.0f;
    axisSet.yAxis.labelTextStyle = textStyle;
    axisSet.yAxis.labelOffset = 3.0f;
    //set axes' line styles and interval ticks
    CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
    lineStyle.lineColor = [CPTColor whiteColor];
    lineStyle.lineWidth = 3.0f;
    axisSet.xAxis.axisLineStyle = lineStyle;
    axisSet.yAxis.axisLineStyle = lineStyle;
    axisSet.xAxis.majorTickLineStyle = lineStyle;
    axisSet.yAxis.majorTickLineStyle = lineStyle;
    axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(5.0f);
    axisSet.yAxis.majorIntervalLength = CPTDecimalFromFloat(5.0f);
    axisSet.xAxis.majorTickLength = 7.0f;
    axisSet.yAxis.majorTickLength = 7.0f;
    axisSet.xAxis.minorTickLineStyle = lineStyle;
    axisSet.yAxis.minorTickLineStyle = lineStyle;
    axisSet.xAxis.minorTicksPerInterval = 1;
    axisSet.yAxis.minorTicksPerInterval = 1;
    axisSet.xAxis.minorTickLength = 5.0f;
    axisSet.yAxis.minorTickLength = 5.0f;

    // Create bar plot and add it to the graph
    CPTBarPlot *plot = [[CPTBarPlot alloc] init] ;
    plot.dataSource = self;
    plot.delegate = self;
    plot.barWidth = [[NSDecimalNumber decimalNumberWithString:@"5.0"]
    plot.barOffset = [[NSDecimalNumber decimalNumberWithString:@"10.0"]
    plot.barCornerRadius = 5.0;
    // Remove bar outlines
    CPTMutableLineStyle *borderLineStyle = [CPTMutableLineStyle lineStyle];
    borderLineStyle.lineColor = [CPTColor clearColor];
    plot.lineStyle = borderLineStyle;
    // Identifiers are handy if you want multiple plots in one graph
    plot.identifier = @"chocoplot";
    [self.graph addPlot:plot];


-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
    if ( [plot.identifier isEqual:@"chocoplot"] )
        return [ count];

    return 0;

-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index
    if ( [plot.identifier isEqual: @"chocoplot"] )
        CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
        textStyle.fontName = @"Helvetica";
        textStyle.fontSize = 14;
        textStyle.color = [CPTColor whiteColor];

        NSDictionary *bar = [ objectAtIndex:index];
        CPTTextLayer *label = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%@", [bar valueForKey:@"CATEGORY"]]];
        label.textStyle =textStyle;

        return label;

    CPTTextLayer *defaultLabel = [[CPTTextLayer alloc] initWithText:@"Label"];
    return defaultLabel;


-(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot
    if ( [barPlot.identifier isEqual:@"chocoplot"] )
        NSDictionary *bar = [ objectAtIndex:index];
        CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:[CPTColor whiteColor]
                                                            endingColor:[bar valueForKey:@"COLOR"]
                                                      beginningPosition:0.0 endingPosition:0.3 ];
        [gradient setGradientType:CPTGradientTypeAxial];
        [gradient setAngle:320.0];

        CPTFill *fill = [CPTFill fillWithGradient:gradient];

        return fill;

    return [CPTFill fillWithColor:[CPTColor colorWithComponentRed:1.0 green:1.0 blue:1.0 alpha:1.0]];


- (void)viewDidLoad
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.



#import <UIKit/UIKit.h>
#import "BarPlotViewController.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) BarPlotViewController *barPlotViewController;



#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize barPlotViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    barPlotViewController = [[BarPlotViewController alloc] init];
    [self.window setRootViewController:barPlotViewController];
    [self.window makeKeyAndVisible];
    return YES;

Image of the Simulator on Ipad:

This is how it looks on iphone same code :


Your datasource needs to implement one of the following methods:

-(NSArray *)numbersForPlot:(CPTPlot *)plot

-(NSNumber *)numberForPlot:(CPTPlot *)plot

-(double *)doublesForPlot:(CPTPlot *)plot

-(double)doubleForPlot:(CPTPlot *)plot

-(CPTNumericData *)dataForPlot:(CPTPlot *)plot

-(CPTNumericData *)dataForPlot:(CPTPlot *)plot

Need Your Help

Tomcat v7.0 server, running in Eclipse, failed to start at localhost

java eclipse apache tomcat

I am trying to install Apache Tomcat server 7.0 in Eclipse Indigo OS-Windows server 2013, while I am starting the server, I am encounter the following error:

Java: Cannot make static reference to non static method

java class error-handling static compiler-errors

I have this class that I'm trying to use to find the number of vowels and number of consonants in a string.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.