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
Kevin
2014-12-01 18:43:52 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3f6e0218834c0f9c874f18aca88e882084a2e1e5
3f6e0218
2 parents
9298fb41
8bfca3e1
Merge pull request #117 from MrWooJ/fixing-Issue#108
fixing issue #108
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
PNChart/PNPieChart.m
PNChart/PNPieChart.m
View file @
3f6e021
...
...
@@ -123,20 +123,27 @@
_currentTotal
+=
currentDataItem
.
value
;
UILabel
*
descriptionLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
100
,
80
)];
NSString
*
titleText
=
currentDataItem
.
textDescription
;
if
(
!
titleText
){
titleText
=
[
NSString
stringWithFormat
:
@"%.0f%%"
,
currentDataItem
.
value
/
_total
*
100
];
descriptionLabel
.
text
=
titleText
;
}
else
{
NSString
*
str
=
[
NSString
stringWithFormat
:
@"%.0f%%
\n
"
,
currentDataItem
.
value
/
_total
*
100
];
str
=
[
str
stringByAppendingString
:
titleText
];
descriptionLabel
.
text
=
str
;
}
CGPoint
center
=
CGPointMake
(
_outerCircleRadius
+
distance
*
sin
(
rad
),
_outerCircleRadius
-
distance
*
cos
(
rad
));
CGRect
frame
;
frame
=
CGRectMake
(
0
,
0
,
100
,
80
);
UILabel
*
descriptionLabel
=
[[
UILabel
alloc
]
initWithFrame
:
frame
];
descriptionLabel
.
text
=
titleText
;
descriptionLabel
.
font
=
_descriptionTextFont
;
CGSize
labelSize
=
[
descriptionLabel
.
text
sizeWithAttributes
:@{
NSFontAttributeName
:
descriptionLabel
.
font
}];
descriptionLabel
.
frame
=
CGRectMake
(
descriptionLabel
.
frame
.
origin
.
x
,
descriptionLabel
.
frame
.
origin
.
y
,
descriptionLabel
.
frame
.
size
.
width
,
labelSize
.
height
);
descriptionLabel
.
numberOfLines
=
0
;
descriptionLabel
.
textColor
=
_descriptionTextColor
;
descriptionLabel
.
shadowColor
=
_descriptionTextShadowColor
;
descriptionLabel
.
shadowOffset
=
_descriptionTextShadowOffset
;
...
...
@@ -144,7 +151,6 @@
descriptionLabel
.
center
=
center
;
descriptionLabel
.
alpha
=
0
;
descriptionLabel
.
backgroundColor
=
[
UIColor
clearColor
];
return
descriptionLabel
;
}
...
...
Please
register
or
login
to post a comment