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
2014-05-29 14:46:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
755fc00a9913a090cc95921c1ed9d0bcf0b67fa8
755fc00a
1 parent
6191c71d
Fix barchart nan bug
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
PNChart/PNBarChart/PNBarChart.h
PNChart/PNBarChart/PNBarChart.m
PNChart/PNBarChart/PNBarChart.h
View file @
755fc00
...
...
@@ -118,6 +118,11 @@ typedef NSString *(^PNyLabelFromatter)(CGFloat yLabelValue);
*/
@property
(
nonatomic
)
CGFloat
yMaxValue
;
/*
yMinValue define the min value of the chart
*/
@property
(
nonatomic
)
CGFloat
yMinValue
;
@property
(
nonatomic
,
retain
)
id
<
PNChartDelegate
>
delegate
;
@end
...
...
PNChart/PNBarChart/PNBarChart.m
View file @
755fc00
...
...
@@ -64,22 +64,13 @@
-
(
void
)
getYValueMax
:(
NSArray
*
)
yLabels
{
NSInteger
max
=
0
;
int
max
=
[[
yLabels
valueForKeyPath
:
@"@max.intValue"
]
intValue
]
;
for
(
NSString
*
valueString
in
yLabels
)
{
NSInteger
value
=
[
valueString
integerValue
];
if
(
value
>
max
)
{
max
=
value
;
}
}
_yValueMax
=
(
int
)
max
;
//Min value for Y label
if
(
max
<
5
)
{
max
=
5
;
if
(
_yValueMax
==
0
)
{
_yValueMax
=
_yMinValue
;
}
_yValueMax
=
(
int
)
max
;
}
...
...
@@ -169,6 +160,11 @@
float
value
=
[
valueString
floatValue
];
float
grade
=
(
float
)
value
/
(
float
)
_yValueMax
;
if
(
isnan
(
grade
))
{
grade
=
0
;
}
PNBar
*
bar
;
CGFloat
barWidth
;
CGFloat
barXPosition
;
...
...
Please
register
or
login
to post a comment