Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments