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-11-16 08:00:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7bb407541e6645c2b456ab0a232bae44bd9006ac
7bb40754
1 parent
4c9f7a17
Fix Line Chart x labels position and size
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
PNChartDemo/PNChart/PNLineChart.h
PNChartDemo/PNChart/PNLineChart.m
PNChartDemo/PNChart/PNLineChart.h
View file @
7bb4075
...
...
@@ -11,7 +11,6 @@
#import <QuartzCore/QuartzCore.h>
#define chartMargin 10
#define xLabelMargin 15
#define yLabelMargin 15
#define yLabelHeight 11
...
...
PNChartDemo/PNChart/PNLineChart.m
View file @
7bb4075
...
...
@@ -75,11 +75,11 @@
-
(
void
)
setXLabels
:(
NSArray
*
)
xLabels
{
_xLabels
=
xLabels
;
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
-
30
.
0
-
([
xLabels
count
]
-
1
)
*
xLabelMargin
)
/
[
xLabels
count
];
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
-
30
.
0
)
/
[
xLabels
count
];
for
(
NSString
*
labelText
in
xLabels
)
{
NSInteger
index
=
[
xLabels
indexOfObject
:
labelText
];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
index
*
(
xLabelMargin
+
_xLabelWidth
)
+
30
.
0
,
self
.
frame
.
size
.
height
-
30
.
0
,
_xLabelWidth
,
20
.
0
)];
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
];
...
...
@@ -101,7 +101,7 @@
CGFloat
firstValue
=
[[
_yValues
objectAtIndex
:
0
]
floatValue
];
CGFloat
xPosition
=
(
xLabelMargin
+
_xLabelWidth
)
;
CGFloat
xPosition
=
_xLabelWidth
;
CGFloat
chartCavanHeight
=
self
.
frame
.
size
.
height
-
chartMargin
*
2
-
40
.
0
;
...
...
Please
register
or
login
to post a comment