Very Easy To Use Open Source iOS Charting Library With A Clean Look

I’ve mentioned a number of open source charting libraries including the extensive Core Plot library, and most recently a library allowing you to create contiguous graphs and clock charts.

Here’s a simple to use charting library with a nice clean style called PNChart.

What sets PNChart apart from other libraries I’ve mentioned is its ease of use. You can easily define the values and labels within a few arrays, and generate some very nice looking charts.

Here’s an image and source code example from the example included with PNChart demonstrating its ease of use:

PNChart

Generated with the code:

    //Add LineChart
    UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, SCREEN_WIDTH, 30)];
    lineChartLabel.text = @"Line Chart";
    lineChartLabel.textColor = PNFreshGreen;
    lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
    lineChartLabel.textAlignment = NSTextAlignmentCenter;
   
    PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 75.0, SCREEN_WIDTH, 200.0)];
    lineChart.backgroundColor = [UIColor clearColor];
    [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
    [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
    [lineChart strokeChart];
    [self.chartScrollView addSubview:lineChartLabel];
    [self.chartScrollView addSubview:lineChart];
   
    //Add BarChart
   
    UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, SCREEN_WIDTH, 30)];
    barChartLabel.text = @"Bar Chart";
    barChartLabel.textColor = PNFreshGreen;
    barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
    barChartLabel.textAlignment = NSTextAlignmentCenter;
   
    PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 335.0, SCREEN_WIDTH, 200.0)];
    barChart.backgroundColor = [UIColor clearColor];
    barChart.type = PNBarType;
    [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
    [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
    [barChart strokeChart];
    [self.chartScrollView addSubview:barChartLabel];
    [self.chartScrollView addSubview:barChart];

You can find PNChart on Github here.

A very easy to use charting library.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Very Easy To Use Open Source iOS Charting Library With A Clean Look

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *