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
Orlando Aleman Ortiz
2014-04-21 16:00:09 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a72813668a5f6001945205be2745c1c643a98b04
a7281366
1 parent
b60d5a45
Macro based distances
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
PNChart/PNBarChart.h
PNChart/PNBarChart.m
PNChart/PNBarChart.h
View file @
a728136
...
...
@@ -12,6 +12,7 @@
#define xLabelMargin 15
#define yLabelMargin 15
#define yLabelHeight 11
#define xLabelHeight 20
@interface
PNBarChart
:
UIView
...
...
PNChart/PNBarChart.m
View file @
a728136
...
...
@@ -85,7 +85,7 @@
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
)];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
((
index
*
_xLabelWidth
+
chartMargin
),
self
.
frame
.
size
.
height
-
xLabelHeight
-
chartMargin
,
_xLabelWidth
,
xLabelHeight
)];
[
label
setTextAlignment
:
NSTextAlignmentCenter
];
label
.
text
=
labelText
;
[
_labels
addObject
:
label
];
...
...
@@ -95,7 +95,7 @@
[
self
viewCleanupForCollection
:
_bars
];
CGFloat
chartCavanHeight
=
self
.
frame
.
size
.
height
-
chartMargin
*
2
-
40
.
0
;
CGFloat
chartCavanHeight
=
self
.
frame
.
size
.
height
-
chartMargin
*
2
-
xLabelHeight
*
2
;
NSInteger
index
=
0
;
for
(
NSString
*
valueString
in
_yValues
)
{
...
...
@@ -104,7 +104,7 @@
float
grade
=
(
float
)
value
/
(
float
)
_yValueMax
;
PNBar
*
bar
;
if
(
_showLabel
)
{
bar
=
[[
PNBar
alloc
]
initWithFrame
:
CGRectMake
((
index
*
_xLabelWidth
+
chartMargin
+
_xLabelWidth
*
0
.
25
),
self
.
frame
.
size
.
height
-
chartCavanHeight
-
30
.
0
,
_xLabelWidth
*
0
.
5
,
chartCavanHeight
)];
bar
=
[[
PNBar
alloc
]
initWithFrame
:
CGRectMake
((
index
*
_xLabelWidth
+
chartMargin
+
_xLabelWidth
*
0
.
25
),
self
.
frame
.
size
.
height
-
chartCavanHeight
-
xLabelHeight
-
chartMargin
,
_xLabelWidth
*
0
.
5
,
chartCavanHeight
)];
}
else
{
...
...
Please
register
or
login
to post a comment