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
Size: 40537
Language: Swift
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
Link your application against the framework. Add the framework to the list of 'Embedded Binaries' from the project's General tab.
Run Terminal
Navigate to project folder
Use command:
init
form :ios, '10.0'
et 'YourProjectName' do
e_frameworks!
pod 'iOSCharts'
install
Remember to open project using workspace
Run Terminal
Navigate to project folder
Use command in terminal:
h cartfile
Add code to Cartfile:
ub "3pillarlabs/ios-charts"
hage update
Basic steps in using the framework:
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.
iOSCharts is released under MIT license. See LICENSE for details.
iOSCharts is developed and maintained by 3Pillar Global.