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
2013-12-17 09:33:18 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
217b18e45efa2496bd47375e023898d31dbc5049
217b18e4
2 parents
8c02df94
d8eab081
Merge branch 'master' of github.com:kevinzhow/PNChart
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
PNChartDemo/PNChart/PNBarChart.m
PNChartDemo/PNChart/PNLineChart.m
PNChartDemo/PNChart/PNBarChart.m
View file @
217b18e
...
...
@@ -62,8 +62,10 @@
if
(
_showLabel
)
{
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
*
2
)
/
[
xLabels
count
];
for
(
NSString
*
labelText
in
xLabels
)
{
NSInteger
index
=
[
xLabels
indexOfObject
:
labelText
];
for
(
int
index
=
0
;
index
<
xLabels
.
count
;
index
++
)
{
NSString
*
labelText
=
xLabels
[
index
];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
((
index
*
_xLabelWidth
+
chartMargin
),
self
.
frame
.
size
.
height
-
30
.
0
,
_xLabelWidth
,
20
.
0
)];
[
label
setTextAlignment
:
NSTextAlignmentCenter
];
label
.
text
=
labelText
;
...
...
PNChartDemo/PNChart/PNLineChart.m
View file @
217b18e
...
...
@@ -77,13 +77,16 @@
if
(
_showLabel
){
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
-
30
.
0
)
/
[
xLabels
count
];
for
(
NSString
*
labelText
in
xLabels
)
{
NSInteger
index
=
[
xLabels
indexOfObject
:
labelText
];
for
(
int
index
=
0
;
index
<
xLabels
.
count
;
index
++
)
{
NSString
*
labelText
=
xLabels
[
index
];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
index
*
_xLabelWidth
+
30
.
0
,
self
.
frame
.
size
.
height
-
30
.
0
,
_xLabelWidth
,
20
.
0
)];
[
label
setTextAlignment
:
NSTextAlignmentCenter
];
label
.
text
=
labelText
;
[
self
addSubview
:
label
];
}
}
else
{
_xLabelWidth
=
(
self
.
frame
.
size
.
width
)
/
[
xLabels
count
];
}
...
...
Please
register
or
login
to post a comment