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
echo
2016-04-15 12:14:23 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
e9e3b1de5e683b2e0a7815b45c5f377bd1026fb1
e9e3b1de
2 parents
7b50134a
dfb777c0
Merge pull request #1 from hugo-/master
定制饼状图
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
PNChart/PNPieChart.h
PNChart/PNPieChart.m
PNChart/PNPieChartDataItem.h
PNChart/PNPieChartDataItem.m
PNChart/PNPieChart.h
View file @
e9e3b1d
...
...
@@ -65,4 +65,7 @@
-
(
void
)
recompute
;
-
(
CGFloat
)
startPercentageForItemAtIndex
:(
NSUInteger
)
index
;
-
(
CGFloat
)
endPercentageForItemAtIndex
:(
NSUInteger
)
index
;
@end
...
...
PNChart/PNPieChart.m
View file @
e9e3b1d
...
...
@@ -26,10 +26,7 @@
-
(
UILabel
*
)
descriptionLabelForItemAtIndex
:(
NSUInteger
)
index
;
-
(
PNPieChartDataItem
*
)
dataItemForIndex
:(
NSUInteger
)
index
;
-
(
CGFloat
)
startPercentageForItemAtIndex
:(
NSUInteger
)
index
;
-
(
CGFloat
)
endPercentageForItemAtIndex
:(
NSUInteger
)
index
;
-
(
CGFloat
)
ratioForItemAtIndex
:(
NSUInteger
)
index
;
-
(
CAShapeLayer
*
)
newCircleLayerWithRadius
:(
CGFloat
)
radius
borderWidth
:(
CGFloat
)
borderWidth
fillColor
:(
UIColor
*
)
fillColor
...
...
PNChart/PNPieChartDataItem.h
View file @
e9e3b1d
...
...
@@ -22,4 +22,13 @@
@property
(
nonatomic
)
UIColor
*
color
;
@property
(
nonatomic
)
NSString
*
textDescription
;
//hehejingjing
@property
(
nonatomic
)
UIColor
*
titlePathColor
;
@property
(
nonatomic
)
CGFloat
titlePathWidth
;
@property
(
nonatomic
)
UIColor
*
titleColor
;
@property
(
nonatomic
)
UIFont
*
titleFont
;
+
(
instancetype
)
dataItemWithValue
:(
CGFloat
)
value
color
:(
UIColor
*
)
color
description
:(
NSString
*
)
description
titlePathColor
:(
UIColor
*
)
titlePathColor
titlePathLineWidth
:(
CGFloat
)
lineWidth
titleColor
:(
UIColor
*
)
titleColor
titleFont
:(
UIFont
*
)
titleFont
;
@end
...
...
PNChart/PNPieChartDataItem.m
View file @
e9e3b1d
...
...
@@ -17,6 +17,11 @@
PNPieChartDataItem
*
item
=
[
PNPieChartDataItem
new
];
item
.
value
=
value
;
item
.
color
=
color
;
item
.
textDescription
=
@""
;
item
.
titlePathColor
=
[
UIColor
blackColor
];
item
.
titlePathWidth
=
0
.
5
;
item
.
titleColor
=
[
UIColor
blackColor
];
item
.
titleFont
=
[
UIFont
systemFontOfSize
:
12
];
return
item
;
}
...
...
@@ -28,6 +33,17 @@
return
item
;
}
+
(
instancetype
)
dataItemWithValue
:(
CGFloat
)
value
color
:(
UIColor
*
)
color
description
:(
NSString
*
)
description
titlePathColor
:(
UIColor
*
)
titlePathColor
titlePathLineWidth
:(
CGFloat
)
lineWidth
titleColor
:(
UIColor
*
)
titleColor
titleFont
:(
UIFont
*
)
titleFont
{
PNPieChartDataItem
*
item
=
[
self
dataItemWithValue
:
value
color
:
color
description
:
description
];
item
.
titlePathColor
=
titlePathColor
;
item
.
titlePathWidth
=
lineWidth
;
item
.
titleColor
=
titleColor
;
item
.
titleFont
=
titleFont
;
return
item
;
}
-
(
void
)
setValue
:(
CGFloat
)
value
{
NSAssert
(
value
>=
0
,
@"value should >= 0"
);
if
(
value
!=
_value
){
...
...
Please
register
or
login
to post a comment