3pillarlabs/ios-charts

Name: ios-charts

Owner: 3Pillar Global Open Source

Description: This framework aims to provide an easy way to visualize a set of data using ?off the shelf? solutions for Line Graph, Stacked Bar Graph and Pie Chart, allowing the user to change the data source by adding or removing new values.

Created: 2016-03-21 13:33:14.0

Updated: 2017-02-17 19:15:10.0

Pushed: 2016-05-27 08:37:33.0

Homepage:

Size: 40537

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

iOSCharts

This framework aims to provide an easy way to visualize a set of data using ?off the shelf? solutions for Line Graph, Stacked Bar Graph and Pie Chart, allowing the user to change the data source by adding or removing new values.

The user also has the possibility to change the colours used in the graphs and to add custom names for the rows and columns of the data source. The framework allows further extension with new types of graphs or customised properties for the graphical overlays (axis, graph or values overlay) based on the code provided in the Framework project.

It is available starting with IOS 8.0 and later and can be used with both Swift and Objective-C programming languages.

Installation

Link your application against the framework. Add the framework to the list of 'Embedded Binaries' from the project's General tab.

CocoaPods
init
form :ios, '10.0'

et 'YourProjectName' do
e_frameworks!
pod 'iOSCharts'

install

Remember to open project using workspace

Carthage
ub "3pillarlabs/ios-charts"
hage update
Usage

Basic steps in using the framework:

  1. Create a graph view of type LineGraphView, PieChartView or SegmentedStackView
  2. Create a data source
  3. Set the graph's data source

Swift

rt IOSCharts

u can instantiate in the same way PieChartView or SegmentedStackView instead of LineGraphView
graph = LineGraphView(frame: CGRect(x: 0, y: 0, width: 200, height: 300))

eate a DataSource
inputTable = GraphInputTable(name: "GraphCustomName")
d as many rows as you want
tTable.rows = [ GraphInputRow(name: "rowName 1", tintColor: UIColor.grayColor()),
                GraphInputRow(name: "rowName 2", tintColor: UIColor.greenColor())]
t the data Source
h.inputTable = inputTable
pulate the data source with random values
values: [Double] = inputTable.rows.map {_ in return Double(arc4random_uniform(100))}
tTable.addColumn("col name", rowValues: values)

Objective-C

 sure in Build Settings, Embedded Content Contains Swift Code is set to "YES"

rt <IOSCharts/IOSCharts.h>
u can instantiate in the same way PieChartView or LineGraphView instead of SegmentedStackView
entedStackView *graph = [[SegmentedStackView alloc] initWithFrame:CGRectMake(0, 0, 200, 300)];

eate a DataSource
hInputTable *inputTable = [[GraphInputTable alloc] initWithName:@"SegmentedStackView"];
tTable.rows = @[[[GraphInputRow alloc] initWithName:@"row1" tintColor:[UIColor redColor]],
                [[GraphInputRow alloc] initWithName:@"row2" tintColor:[UIColor greenColor]]];
t the data Source                   
.segmentedStackView.inputTable = inputTable;

numberOfColumns = 2;
numberOfRows = (int)[inputTable.rows count];

pulate the data source with random values    
(int j = 0; j < numberOfColumns; j++) {
NSMutableArray *rowValues = [[NSMutableArray alloc] init];
or (int i = 0; i < numberOfRows; i++) {
    [rowValues addObject:[NSNumber numberWithInt:arc4random_uniform(100)]];

inputTable addColumn:@"column" rowValues:rowValues];
                

A demo is available on demo branch.

License

iOSCharts is released under MIT license. See LICENSE for details.

About this project

3Pillar Global

iOSCharts is developed and maintained by 3Pillar Global.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.