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
Marcin Czachurski
2013-12-15 20:54:09 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9074b5d48527628464cdb8e8541c2a0b72cb1edb
9074b5d4
1 parent
47e8c79c
Chart not showing legends with this same text.
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 @
9074b5d
...
...
@@ -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 @
9074b5d
...
...
@@ -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