Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
PNChart
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Gabe Heafitz
2014-10-30 18:54:35 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3f51a54341ecda76ae7dd442c5bb15ed781241c1
3f51a543
1 parent
a512af93
Optimize imports.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
51 deletions
PNChart/PNChartLabel.m
PNChartDemo/PCChartsTableViewController.m
PNChartDemo/main.m
PNChart/PNChartLabel.m
View file @
3f51a54
...
...
@@ -7,7 +7,6 @@
//
#import "PNChartLabel.h"
#import "PNColor.h"
@implementation
PNChartLabel
...
...
PNChartDemo/PCChartsTableViewController.m
View file @
3f51a54
...
...
@@ -7,9 +7,6 @@
//
#import "PCChartsTableViewController.h"
#import "PNChart.h"
#import "PNLineChartData.h"
#import "PNLineChartDataItem.h"
@interface
PCChartsTableViewController
()
...
...
@@ -32,7 +29,7 @@
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
...
...
@@ -48,18 +45,18 @@
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
UIViewController
*
viewController
=
[
segue
destinationViewController
];
if
([
segue
.
identifier
isEqualToString
:
@"lineChart"
])
{
//Add LineChart
UILabel
*
lineChartLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
90
,
SCREEN_WIDTH
,
30
)];
lineChartLabel
.
text
=
@"Line Chart"
;
lineChartLabel
.
textColor
=
PNFreshGreen
;
lineChartLabel
.
font
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
23
.
0
];
lineChartLabel
.
textAlignment
=
NSTextAlignmentCenter
;
PNLineChart
*
lineChart
=
[[
PNLineChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
135
.
0
,
SCREEN_WIDTH
,
200
.
0
)];
lineChart
.
yLabelFormat
=
@"%1.1f"
;
lineChart
.
backgroundColor
=
[
UIColor
clearColor
];
...
...
@@ -90,24 +87,24 @@
lineChart
.
chartData
=
@[
data01
,
data02
];
[
lineChart
strokeChart
];
lineChart
.
delegate
=
self
;
[
viewController
.
view
addSubview
:
lineChartLabel
];
[
viewController
.
view
addSubview
:
lineChart
];
viewController
.
title
=
@"Line Chart"
;
}
else
if
([
segue
.
identifier
isEqualToString
:
@"barChart"
])
{
//Add BarChart
UILabel
*
barChartLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
90
,
SCREEN_WIDTH
,
30
)];
barChartLabel
.
text
=
@"Bar Chart"
;
barChartLabel
.
textColor
=
PNFreshGreen
;
barChartLabel
.
font
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
23
.
0
];
barChartLabel
.
textAlignment
=
NSTextAlignmentCenter
;
self
.
barChart
=
[[
PNBarChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
135
.
0
,
SCREEN_WIDTH
,
200
.
0
)];
self
.
barChart
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
barChart
.
yLabelFormatter
=
^
(
CGFloat
yValue
){
...
...
@@ -123,71 +120,71 @@
self
.
barChart
.
barColorGradientStart
=
[
UIColor
blueColor
];
[
self
.
barChart
strokeChart
];
self
.
barChart
.
delegate
=
self
;
[
viewController
.
view
addSubview
:
barChartLabel
];
[
viewController
.
view
addSubview
:
self
.
barChart
];
viewController
.
title
=
@"Bar Chart"
;
}
else
if
([
segue
.
identifier
isEqualToString
:
@"circleChart"
])
{
//Add CircleChart
UILabel
*
circleChartLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
90
,
SCREEN_WIDTH
,
30
)];
circleChartLabel
.
text
=
@"Circle Chart"
;
circleChartLabel
.
textColor
=
PNFreshGreen
;
circleChartLabel
.
font
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
23
.
0
];
circleChartLabel
.
textAlignment
=
NSTextAlignmentCenter
;
PNCircleChart
*
circleChart
=
[[
PNCircleChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
80
.
0
,
SCREEN_WIDTH
,
100
.
0
)
andTotal
:
@100
andCurrent
:
@60
andClockwise
:
YES
andShadow
:
YES
];
circleChart
.
backgroundColor
=
[
UIColor
clearColor
];
[
circleChart
setStrokeColor
:
PNGreen
];
[
circleChart
setStrokeColorGradientStart
:[
UIColor
blueColor
]];
[
circleChart
strokeChart
];
[
viewController
.
view
addSubview
:
circleChartLabel
];
[
viewController
.
view
addSubview
:
circleChart
];
viewController
.
title
=
@"Circle Chart"
;
}
else
if
([
segue
.
identifier
isEqualToString
:
@"pieChart"
])
{
//Add PieChart
UILabel
*
pieChartLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
90
,
SCREEN_WIDTH
,
30
)];
pieChartLabel
.
text
=
@"Pie Chart"
;
pieChartLabel
.
textColor
=
PNFreshGreen
;
pieChartLabel
.
font
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
23
.
0
];
pieChartLabel
.
textAlignment
=
NSTextAlignmentCenter
;
NSArray
*
items
=
@[[
PNPieChartDataItem
dataItemWithValue
:
10
color
:
PNLightGreen
],
[
PNPieChartDataItem
dataItemWithValue
:
20
color
:
PNFreshGreen
description
:
@"WWDC"
],
[
PNPieChartDataItem
dataItemWithValue
:
40
color
:
PNDeepGreen
description
:
@"GOOL I/O"
],
];
PNPieChart
*
pieChart
=
[[
PNPieChart
alloc
]
initWithFrame
:
CGRectMake
(
40
.
0
,
155
.
0
,
240
.
0
,
240
.
0
)
items
:
items
];
pieChart
.
descriptionTextColor
=
[
UIColor
whiteColor
];
pieChart
.
descriptionTextFont
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
14
.
0
];
pieChart
.
descriptionTextShadowColor
=
[
UIColor
clearColor
];
[
pieChart
strokeChart
];
[
viewController
.
view
addSubview
:
pieChartLabel
];
[
viewController
.
view
addSubview
:
pieChart
];
viewController
.
title
=
@"Pie Chart"
;
}
}
-
(
void
)
userClickedOnLineKeyPoint
:
(
CGPoint
)
point
lineIndex
:
(
NSInteger
)
lineIndex
andPointIndex
:
(
NSInteger
)
pointIndex
{
...
...
@@ -200,29 +197,29 @@
-
(
void
)
userClickedOnBarCharIndex
:
(
NSInteger
)
barIndex
{
NSLog
(
@"Click on bar %@"
,
@
(
barIndex
));
PNBar
*
bar
=
[
self
.
barChart
.
bars
objectAtIndex
:
barIndex
];
CABasicAnimation
*
animation
=
[
CABasicAnimation
animationWithKeyPath
:
@"transform.scale"
];
animation
.
fromValue
=
@1.0
;
animation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
animation
.
toValue
=
@1.1
;
animation
.
duration
=
0
.
2
;
animation
.
repeatCount
=
0
;
animation
.
autoreverses
=
YES
;
animation
.
removedOnCompletion
=
YES
;
animation
.
fillMode
=
kCAFillModeForwards
;
[
bar
.
layer
addAnimation
:
animation
forKey
:
@"Float"
];
}
...
...
PNChartDemo/main.m
View file @
3f51a54
...
...
@@ -6,8 +6,6 @@
// Copyright (c) 2013年 kevinzhow. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PCAppDelegate.h"
int
main
(
int
argc
,
char
*
argv
[])
...
...
Please
register
or
login
to post a comment