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
rochefort
2014-05-03 00:14:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
545eafb194a31a44a6dc6bafe78678ca838d5bea
545eafb1
1 parent
c930f6a6
Convert to modern Objective-C syntax
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
16 deletions
PNChart/PNBarChart/PNBar.m
PNChart/PNBarChart/PNBarChart.m
PNChart/PNCircleChart/PNCircleChart.m
PNChart/PNLineChart/PNLineChart.m
PNChartDemo/PCChartsTableViewController.m
README.md
PNChart/PNBarChart/PNBar.m
View file @
545eafb
...
...
@@ -59,8 +59,8 @@
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
1
.
0
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
0
f
]
;
pathAnimation
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
]
;
pathAnimation
.
fromValue
=
@0.0f
;
pathAnimation
.
toValue
=
@1.0f
;
[
_chartLine
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
_chartLine
.
strokeEnd
=
1
.
0
;
...
...
PNChart/PNBarChart/PNBarChart.m
View file @
545eafb
...
...
@@ -244,8 +244,8 @@
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
0
.
5
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
0
f
]
;
pathAnimation
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
]
;
pathAnimation
.
fromValue
=
@0.0f
;
pathAnimation
.
toValue
=
@1.0f
;
[
_chartBottomLine
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
_chartBottomLine
.
strokeEnd
=
1
.
0
;
...
...
@@ -276,8 +276,8 @@
CABasicAnimation
*
pathLeftAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathLeftAnimation
.
duration
=
0
.
5
;
pathLeftAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathLeftAnimation
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
0
f
]
;
pathLeftAnimation
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
]
;
pathLeftAnimation
.
fromValue
=
@0.0f
;
pathLeftAnimation
.
toValue
=
@1.0f
;
[
_chartLeftLine
addAnimation
:
pathLeftAnimation
forKey
:
@"strokeEndAnimation"
];
_chartLeftLine
.
strokeEnd
=
1
.
0
;
...
...
PNChart/PNCircleChart/PNCircleChart.m
View file @
545eafb
...
...
@@ -40,7 +40,7 @@
CGFloat
startAngle
=
clockwise
?
-
90
.
0
f
:
270
.
0
f
;
CGFloat
endAngle
=
clockwise
?
-
90
.
01
f
:
270
.
01
f
;
_lineWidth
=
[
NSNumber
numberWithFloat
:
8
.
0
]
;
_lineWidth
=
@8.0f
;
UIBezierPath
*
circlePath
=
[
UIBezierPath
bezierPathWithArcCenter
:
CGPointMake
(
self
.
center
.
x
,
self
.
center
.
y
)
radius
:
self
.
frame
.
size
.
height
*
0
.
5
startAngle
:
DEGREES_TO_RADIANS
(
startAngle
)
endAngle
:
DEGREES_TO_RADIANS
(
endAngle
)
clockwise
:
clockwise
];
_circle
=
[
CAShapeLayer
layer
];
...
...
@@ -94,8 +94,8 @@
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
1
.
0
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
0
f
]
;
pathAnimation
.
toValue
=
[
NSNumber
numberWithFloat
:[
_current
floatValue
]
/
[
_total
floatValue
]]
;
pathAnimation
.
fromValue
=
@0.0f
;
pathAnimation
.
toValue
=
@
([
_current
floatValue
]
/
[
_total
floatValue
])
;
[
_circle
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
_circle
.
strokeEnd
=
[
_current
floatValue
]
/
[
_total
floatValue
];
...
...
PNChart/PNLineChart/PNLineChart.m
View file @
545eafb
...
...
@@ -238,8 +238,8 @@
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
1
.
0
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
0
f
]
;
pathAnimation
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
]
;
pathAnimation
.
fromValue
=
@0.0f
;
pathAnimation
.
toValue
=
@1.0f
;
[
chartLine
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
chartLine
.
strokeEnd
=
1
.
0
;
...
...
PNChartDemo/PCChartsTableViewController.m
View file @
545eafb
...
...
@@ -70,7 +70,7 @@
data01
.
color
=
PNFreshGreen
;
data01
.
itemCount
=
lineChart
.
xLabels
.
count
;
data01
.
getData
=
^
(
NSUInteger
index
)
{
CGFloat
yValue
=
[
[
data01Array
objectAtIndex
:
index
]
floatValue
];
CGFloat
yValue
=
[
data01Array
[
index
]
floatValue
];
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
};
...
...
@@ -80,7 +80,7 @@
data02
.
color
=
PNTwitterColor
;
data02
.
itemCount
=
lineChart
.
xLabels
.
count
;
data02
.
getData
=
^
(
NSUInteger
index
)
{
CGFloat
yValue
=
[
[
data02Array
objectAtIndex
:
index
]
floatValue
];
CGFloat
yValue
=
[
data02Array
[
index
]
floatValue
];
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
};
...
...
@@ -135,7 +135,7 @@
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
:
[
NSNumber
numberWithInt
:
100
]
andCurrent
:
[
NSNumber
numberWithInt
:
60
]
andClockwise
:
YES
andShadow
:
YES
];
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
strokeChart
];
...
...
README.md
View file @
545eafb
...
...
@@ -49,7 +49,7 @@ You will need LLVM 3.0 or later in order to build PNChart.
data01.color = PNFreshGreen;
data01.itemCount = lineChart.xLabels.count;
data01.getData = ^(NSUInteger index) {
CGFloat yValue = [
[data01Array objectAtIndex:
index] floatValue];
CGFloat yValue = [
data01Array[
index] floatValue];
return [PNLineChartDataItem dataItemWithY:yValue];
};
// Line Chart No.2
...
...
@@ -58,7 +58,7 @@ You will need LLVM 3.0 or later in order to build PNChart.
data02.color = PNTwitterColor;
data02.itemCount = lineChart.xLabels.count;
data02.getData = ^(NSUInteger index) {
CGFloat yValue = [
[data02Array objectAtIndex:
index] floatValue];
CGFloat yValue = [
data02Array[
index] floatValue];
return [PNLineChartDataItem dataItemWithY:yValue];
};
...
...
Please
register
or
login
to post a comment