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
David Bleicher
2015-06-30 13:52:32 -0400
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ab9a7770c751733ce6695eabad78c503726ff753
ab9a7770
2 parents
344d53b5
d62cfbde
Merge branch 'master' into CircleUpdateBug1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
15 deletions
PNChart.podspec
PNChart/PNBarChart.m
PNChart/PNLineChart.m
PNChartDemo/PCChartViewController.m
PNChart.podspec
View file @
ab9a777
...
...
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#
s
.
name
=
"PNChart"
s
.
version
=
"0.8.
3
"
s
.
version
=
"0.8.
5
"
s
.
summary
=
"A simple and beautiful chart lib with animation used in Piner for iOS"
s
.
description
=
<<-
DESC
...
...
@@ -90,7 +90,7 @@ Pod::Spec.new do |s|
# Supports git, hg, bzr, svn and HTTP.
#
s
.
source
=
{
:git
=>
"https://github.com/kevinzhow/PNChart.git"
,
:tag
=>
"0.8.
3
"
}
s
.
source
=
{
:git
=>
"https://github.com/kevinzhow/PNChart.git"
,
:tag
=>
"0.8.
5
"
}
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...
...
PNChart/PNBarChart.m
View file @
ab9a777
...
...
@@ -76,27 +76,33 @@
if
(
_showLabel
)
{
[
self
__addYCoordinateLabelsValues
];
}
else
{
[
self
processYMaxValue
];
}
}
-
(
void
)
processYMaxValue
{
NSArray
*
yAxisValues
=
_yLabels
?
_yLabels
:
_yValues
;
_yLabelSum
=
_yLabels
?
_yLabels
.
count
-
1
:
_yLabelSum
;
if
(
_yMaxValue
)
{
_yValueMax
=
_yMaxValue
;
}
else
{
[
self
getYValueMax
:
yAxisValues
];
}
if
(
_yLabelSum
==
4
)
{
_yLabelSum
=
yAxisValues
.
count
;
(
_yLabelSum
%
2
==
0
)
?
_yLabelSum
:
_yLabelSum
++
;
}
}
#pragma mark - Private Method
#pragma mark - 添加柱状图的Y轴坐标
-
(
void
)
__addYCoordinateLabelsValues
{
[
self
viewCleanupForCollection
:
_yChartLabels
];
NSArray
*
yAxisValues
=
_yLabels
?
_yLabels
:
_yValues
;
_yLabelSum
=
_yLabels
?
_yLabels
.
count
-
1
:
_yLabelSum
;
if
(
_yMaxValue
)
{
_yValueMax
=
_yMaxValue
;
}
else
{
[
self
getYValueMax
:
yAxisValues
];
}
if
(
_yLabelSum
==
4
)
{
_yLabelSum
=
yAxisValues
.
count
;
(
_yLabelSum
%
2
==
0
)
?
_yLabelSum
:
_yLabelSum
++
;
}
[
self
processYMaxValue
];
float
sectionHeight
=
(
self
.
frame
.
size
.
height
-
_chartMargin
*
2
-
kXLabelHeight
)
/
_yLabelSum
;
for
(
int
i
=
0
;
i
<=
_yLabelSum
;
i
++
)
{
...
...
PNChart/PNLineChart.m
View file @
ab9a777
...
...
@@ -1026,7 +1026,7 @@
[
self
.
layer
addSublayer
:
textLayer
];
[
textLayer
setFontSize
:
textheigt
/
2
];
[
textLayer
setString
:[[
NSString
alloc
]
initWithFormat
:
@"%
ld"
,(
NSInteger
)(
grade
*
100
)]];
[
textLayer
setString
:[[
NSString
alloc
]
initWithFormat
:
@"%
d"
,(
int
)(
grade
*
100
)]];
[
textLayer
setFrame
:
CGRectMake
(
0
,
0
,
textWidth
,
textheigt
)];
[
textLayer
setPosition
:
CGPointMake
(
pointCenter
.
x
,
textStartPosY
)];
textLayer
.
contentsScale
=
[
UIScreen
mainScreen
].
scale
;
...
...
PNChartDemo/PCChartViewController.m
View file @
ab9a777
...
...
@@ -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