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
kevinzhow
2013-12-10 21:34:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bf05af2e0e38569cc15407c1dcb3e7629f9af5d7
bf05af2e
1 parent
e84f822c
Improve performence for linechart
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
PNChartDemo/PNChart/PNLineChart.m
PNChartDemo/PNChart/PNLineChart.m
View file @
bf05af2
...
...
@@ -112,16 +112,17 @@
CGFloat
firstValue
=
[[
_yValues
objectAtIndex
:
0
]
floatValue
];
CGFloat
xPosition
=
0
;
CGFloat
chartCavanHeight
=
self
.
frame
.
size
.
height
-
40
.
0
;
CGFloat
xLabelHeight
=
20
.
0
;
CGFloat
chartCavanHeight
=
self
.
frame
.
size
.
height
-
xLabelHeight
*
2
;
if
(
_showLabel
){
chartCavanHeight
=
self
.
frame
.
size
.
height
-
chartMargin
*
2
-
40
.
0
;
chartCavanHeight
=
self
.
frame
.
size
.
height
-
chartMargin
*
2
-
xLabelHeight
*
2
;
xPosition
=
_xLabelWidth
;
}
float
grade
=
(
float
)
firstValue
/
(
float
)
_yValueMax
;
[
progressline
moveToPoint
:
CGPointMake
(
xPosition
,
chartCavanHeight
-
grade
*
chartCavanHeight
+
20
.
0
)];
[
progressline
moveToPoint
:
CGPointMake
(
xPosition
,
chartCavanHeight
-
grade
*
chartCavanHeight
+
xLabelHeight
)];
[
progressline
setLineWidth
:
3
.
0
];
[
progressline
setLineCapStyle
:
kCGLineCapRound
];
[
progressline
setLineJoinStyle
:
kCGLineJoinRound
];
...
...
@@ -132,9 +133,11 @@
float
grade
=
(
float
)
value
/
(
float
)
_yValueMax
;
if
(
index
!=
0
)
{
[
progressline
addLineToPoint
:
CGPointMake
(
index
*
_xLabelWidth
+
30
.
0
+
_xLabelWidth
/
2
.
0
,
chartCavanHeight
-
grade
*
chartCavanHeight
+
20
.
0
)];
[
progressline
moveToPoint
:
CGPointMake
(
index
*
_xLabelWidth
+
30
.
0
+
_xLabelWidth
/
2
.
0
,
chartCavanHeight
-
grade
*
chartCavanHeight
+
20
.
0
)];
CGPoint
point
=
CGPointMake
(
index
*
_xLabelWidth
+
30
.
0
+
_xLabelWidth
/
2
.
0
,
chartCavanHeight
-
(
grade
*
chartCavanHeight
)
+
xLabelHeight
);
[
progressline
addLineToPoint
:
point
];
[
progressline
moveToPoint
:
point
];
}
index
+=
1
;
...
...
Please
register
or
login
to post a comment