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
2013-12-15 13:50:44 -0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
d8eab081c6470dae6f1e2d9058eaf3ae9a2d093e
d8eab081
2 parents
47e8c79c
9074b5d4
Merge pull request #21 from mczachurski/master
Chart not showing legends with this same text.
Show 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 @
d8eab08
...
...
@@ -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 @
d8eab08
...
...
@@ -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