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
kevinzhow
2015-01-16 22:44:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
78351dfdaffb4896c99cc37d3625d508e1060d1a
78351dfd
1 parent
f417241e
Fix circle chart
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
PNChart/PNCircleChart.h
PNChart/PNCircleChart.m
PNChartDemo/PCChartViewController.m
PNChart/PNCircleChart.h
View file @
78351df
...
...
@@ -26,8 +26,7 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) {
-
(
id
)
initWithFrame
:(
CGRect
)
frame
total
:(
NSNumber
*
)
total
current
:(
NSNumber
*
)
current
clockwise
:(
BOOL
)
clockwise
shadow
:(
BOOL
)
hasBackgroundShadow
;
clockwise
:(
BOOL
)
clockwise
;
-
(
id
)
initWithFrame
:(
CGRect
)
frame
total
:(
NSNumber
*
)
total
...
...
PNChart/PNCircleChart.m
View file @
78351df
...
...
@@ -13,14 +13,14 @@
@implementation
PNCircleChart
-
(
id
)
initWithFrame
:(
CGRect
)
frame
total
:(
NSNumber
*
)
total
current
:(
NSNumber
*
)
current
clockwise
:(
BOOL
)
clockwise
shadow
:(
BOOL
)
hasBackgroundShadow
{
-
(
id
)
initWithFrame
:(
CGRect
)
frame
total
:(
NSNumber
*
)
total
current
:(
NSNumber
*
)
current
clockwise
:(
BOOL
)
clockwise
{
return
[
self
initWithFrame
:
frame
total
:
total
current:
current
clockwise:
clockwise
shadow:
shadow
shadowColor:
PNGreen
shadow:
NO
shadowColor:
[
UIColor
clearColor
]
displayCountingLabel:
YES
overrideLineWidth:
@8.0f
];
...
...
@@ -77,7 +77,7 @@ displayCountingLabel:(BOOL)displayCountingLabel
_lineWidth
=
overrideLineWidth
;
UIBezierPath
*
circlePath
=
[
UIBezierPath
bezierPathWithArcCenter
:
CGPointMake
(
self
.
bounds
.
size
.
width
/
2
.
0
f
,
self
.
bounds
.
size
.
height
/
2
.
0
f
)
UIBezierPath
*
circlePath
=
[
UIBezierPath
bezierPathWithArcCenter
:
CGPointMake
(
self
.
frame
.
size
.
width
/
2
.
0
f
,
self
.
frame
.
size
.
height
/
2
.
0
f
)
radius
:(
self
.
frame
.
size
.
height
*
0
.
5
)
-
([
_lineWidth
floatValue
]
/
2
.
0
f
)
startAngle:
DEGREES_TO_RADIANS
(
startAngle
)
endAngle:
DEGREES_TO_RADIANS
(
endAngle
)
...
...
@@ -107,7 +107,7 @@ displayCountingLabel:(BOOL)displayCountingLabel
[
_countingLabel
setFont
:[
UIFont
boldSystemFontOfSize
:
16
.
0
f
]];
[
_countingLabel
setTextColor
:[
UIColor
grayColor
]];
[
_countingLabel
setBackgroundColor
:[
UIColor
clearColor
]];
[
_countingLabel
setCenter
:
CGPointMake
(
self
.
center
.
x
,
self
.
center
.
y
)];
[
_countingLabel
setCenter
:
CGPointMake
(
self
.
frame
.
size
.
width
/
2
.
0
f
,
self
.
frame
.
size
.
height
/
2
.
0
f
)];
_countingLabel
.
method
=
UILabelCountingMethodEaseInOut
;
if
(
_displayCountingLabel
)
{
[
self
addSubview
:
_countingLabel
];
...
...
PNChartDemo/PCChartViewController.m
View file @
78351df
...
...
@@ -92,13 +92,14 @@
self
.
titleLabel
.
text
=
@"Circle Chart"
;
self
.
circleChart
=
[[
PNCircleChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
8
0
.
0
,
SCREEN_WIDTH
,
100
.
0
)
self
.
circleChart
=
[[
PNCircleChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
15
0
.
0
,
SCREEN_WIDTH
,
100
.
0
)
total
:
@100
current
:
@60
clockwise
:
YES
shadow
:
YES
];
clockwise
:
YES
];
self
.
circleChart
.
backgroundColor
=
[
UIColor
clearColor
];
[
self
.
circleChart
setStrokeColor
:
PNGreen
];
[
self
.
circleChart
setStrokeColor
:[
UIColor
clearColor
]];
[
self
.
circleChart
setStrokeColorGradientStart
:[
UIColor
blueColor
]];
[
self
.
circleChart
strokeChart
];
...
...
Please
register
or
login
to post a comment