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-06-24 23:05:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a0615c0543352739e08547fd7a369fb6468a863c
a0615c05
1 parent
a5f7b01a
Fix #210
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
PNChart/PNBarChart.m
PNChartDemo/PCChartViewController.m
PNChart/PNBarChart.m
View file @
a0615c0
...
...
@@ -76,15 +76,12 @@
if
(
_showLabel
)
{
[
self
__addYCoordinateLabelsValues
];
}
else
{
[
self
processYMaxValue
];
}
}
#pragma mark - Private Method
#pragma mark - 添加柱状图的Y轴坐标
-
(
void
)
__addYCoordinateLabelsValues
{
[
self
viewCleanupForCollection
:
_yChartLabels
];
-
(
void
)
processYMaxValue
{
NSArray
*
yAxisValues
=
_yLabels
?
_yLabels
:
_yValues
;
_yLabelSum
=
_yLabels
?
_yLabels
.
count
-
1
:
_yLabelSum
;
if
(
_yMaxValue
)
{
...
...
@@ -97,6 +94,15 @@
_yLabelSum
=
yAxisValues
.
count
;
(
_yLabelSum
%
2
==
0
)
?
_yLabelSum
:
_yLabelSum
++
;
}
}
#pragma mark - Private Method
#pragma mark - 添加柱状图的Y轴坐标
-
(
void
)
__addYCoordinateLabelsValues
{
[
self
viewCleanupForCollection
:
_yChartLabels
];
[
self
processYMaxValue
];
float
sectionHeight
=
(
self
.
frame
.
size
.
height
-
_chartMargin
*
2
-
kXLabelHeight
)
/
_yLabelSum
;
for
(
int
i
=
0
;
i
<=
_yLabelSum
;
i
++
)
{
...
...
PNChartDemo/PCChartViewController.m
View file @
a0615c0
...
...
@@ -94,6 +94,7 @@
self
.
titleLabel
.
text
=
@"Bar Chart"
;
self
.
barChart
=
[[
PNBarChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
135
.
0
,
SCREEN_WIDTH
,
200
.
0
)];
self
.
barChart
.
showLabel
=
NO
;
self
.
barChart
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
barChart
.
yLabelFormatter
=
^
(
CGFloat
yValue
){
CGFloat
yValueParsed
=
yValue
;
...
...
@@ -108,6 +109,7 @@
[
self
.
barChart
setStrokeColors
:@[
PNGreen
,
PNGreen
,
PNRed
,
PNGreen
,
PNGreen
,
PNGreen
,
PNRed
,
PNGreen
]];
self
.
barChart
.
isGradientShow
=
NO
;
self
.
barChart
.
isShowNumbers
=
NO
;
[
self
.
barChart
strokeChart
];
self
.
barChart
.
delegate
=
self
;
...
...
Please
register
or
login
to post a comment