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
Antoine Gamond
2014-08-27 11:07:37 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f49d2f193249eb00590873bfcc4f939bac143d3f
f49d2f19
1 parent
c0d69072
Fix blurred label when coordinates aren't integer
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
PNChart/PNLineChart.m
PNChart/PNLineChart.m
View file @
f49d2f1
...
...
@@ -65,17 +65,17 @@
NSString
*
yLabelFormat
=
self
.
yLabelFormat
?
:
@"%1.f"
;
if
(
yStep
==
0
.
0
)
{
PNChartLabel
*
minLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
_chartCavanHeight
,
_chartMargin
,
_yLabelHeight
)];
PNChartLabel
*
minLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
(
NSInteger
)
_chartCavanHeight
,
(
NSInteger
)
_chartMargin
,
(
NSInteger
)
_yLabelHeight
)];
minLabel
.
text
=
[
NSString
stringWithFormat
:
yLabelFormat
,
0
.
0
];
[
self
setCustomStyleForYLabel
:
minLabel
];
[
self
addSubview
:
minLabel
];
PNChartLabel
*
midLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
_chartCavanHeight
/
2
,
_chartMargin
,
_yLabelHeight
)];
PNChartLabel
*
midLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
(
NSInteger
)(
_chartCavanHeight
/
2
),
(
NSInteger
)
_chartMargin
,
(
NSInteger
)
_yLabelHeight
)];
midLabel
.
text
=
[
NSString
stringWithFormat
:
yLabelFormat
,
_yValueMax
];
[
self
setCustomStyleForYLabel
:
midLabel
];
[
self
addSubview
:
midLabel
];
PNChartLabel
*
maxLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
0
.
0
,
_chartMargin
,
_yLabelHeight
)];
PNChartLabel
*
maxLabel
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
0
.
0
,
(
NSInteger
)
_chartMargin
,
(
NSInteger
)
_yLabelHeight
)];
maxLabel
.
text
=
[
NSString
stringWithFormat
:
yLabelFormat
,
_yValueMax
*
2
];
[
self
setCustomStyleForYLabel
:
maxLabel
];
[
self
addSubview
:
maxLabel
];
...
...
@@ -86,7 +86,7 @@
while
(
num
>
0
)
{
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
(
_chartCavanHeight
-
index
*
yStepHeight
),
_chartMargin
,
_yLabelHeight
)];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
0
.
0
,
(
NSInteger
)(
_chartCavanHeight
-
index
*
yStepHeight
),
(
NSInteger
)
_chartMargin
,
(
NSInteger
)
_yLabelHeight
)];
[
label
setTextAlignment
:
NSTextAlignmentRight
];
label
.
text
=
[
NSString
stringWithFormat
:
yLabelFormat
,
_yValueMin
+
(
yStep
*
index
)];
[
self
setCustomStyleForYLabel
:
label
];
...
...
@@ -124,7 +124,7 @@
NSInteger
x
=
2
*
_chartMargin
+
(
index
*
_xLabelWidth
)
-
(
_xLabelWidth
/
2
);
NSInteger
y
=
_chartMargin
+
_chartCavanHeight
;
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
x
,
y
,
_xLabelWidth
,
_chartMargin
)];
PNChartLabel
*
label
=
[[
PNChartLabel
alloc
]
initWithFrame
:
CGRectMake
(
x
,
y
,
(
NSInteger
)
_xLabelWidth
,
(
NSInteger
)
_chartMargin
)];
[
label
setTextAlignment
:
NSTextAlignmentCenter
];
label
.
text
=
labelText
;
[
self
setCustomStyleForXLabel
:
label
];
...
...
@@ -142,6 +142,7 @@
if
(
_xLabelColor
)
{
label
.
textColor
=
_xLabelColor
;
}
}
-
(
void
)
setCustomStyleForYLabel
:(
UILabel
*
)
label
...
...
Please
register
or
login
to post a comment