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
2015-01-15 16:08:27 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
f417241effecf953a173ab5a7fa3c4a8a9d3966d
f417241e
2 parents
b8084a45
9bfcbb64
Merge pull request #145 from JunsionGu/master
Fix little issue in PNLineChart.m
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
PNChart/PNLineChart.m
PNChart/PNLineChart.m
View file @
f417241
...
...
@@ -19,7 +19,7 @@
@property
(
nonatomic
)
NSMutableArray
*
chartPath
;
// Array of line path, one for each line.
@property
(
nonatomic
)
NSMutableArray
*
pointPath
;
// Array of point path, one for each line
@property
(
nonatomic
)
NSMutableArray
*
endPointsOfPath
;
// Array of start and end points of each line path, one for each line
@end
@implementation
PNLineChart
...
...
@@ -189,9 +189,9 @@
CGPoint
touchPoint
=
[
touch
locationInView
:
self
];
for
(
NSInteger
p
=
_pathPoints
.
count
-
1
;
p
>=
0
;
p
--
)
{
NSArray
*
linePointsArray
=
_
pathPoints
[
p
];
NSArray
*
linePointsArray
=
_
endPointsOfPath
[
p
];
for
(
int
i
=
0
;
i
<
linePointsArray
.
count
-
1
;
i
+=
1
)
{
for
(
int
i
=
0
;
i
<
linePointsArray
.
count
-
1
;
i
+=
2
)
{
CGPoint
p1
=
[
linePointsArray
[
i
]
CGPointValue
];
CGPoint
p2
=
[
linePointsArray
[
i
+
1
]
CGPointValue
];
...
...
@@ -251,7 +251,7 @@
_chartPath
=
[[
NSMutableArray
alloc
]
init
];
_pointPath
=
[[
NSMutableArray
alloc
]
init
];
[
self
calculateChartPath
:
_chartPath
andPointsPath
:
_pointPath
andPathKeyPoints
:
_pathPoints
];
[
self
calculateChartPath
:
_chartPath
andPointsPath
:
_pointPath
andPathKeyPoints
:
_pathPoints
andPathStartEndPoints
:
_endPointsOfPath
];
// Draw each line
for
(
NSUInteger
lineIndex
=
0
;
lineIndex
<
self
.
chartData
.
count
;
lineIndex
++
)
{
PNLineChartData
*
chartData
=
self
.
chartData
[
lineIndex
];
...
...
@@ -294,7 +294,7 @@
}
-
(
void
)
calculateChartPath
:
(
NSMutableArray
*
)
chartPath
andPointsPath
:
(
NSMutableArray
*
)
pointsPath
andPathKeyPoints
:
(
NSMutableArray
*
)
pathPoints
-
(
void
)
calculateChartPath
:
(
NSMutableArray
*
)
chartPath
andPointsPath
:
(
NSMutableArray
*
)
pointsPath
andPathKeyPoints
:
(
NSMutableArray
*
)
pathPoints
andPathStartEndPoints
:
(
NSMutableArray
*
)
pointsOfPath
{
// Draw each line
...
...
@@ -320,7 +320,7 @@
}
NSMutableArray
*
linePointsArray
=
[[
NSMutableArray
alloc
]
init
];
NSMutableArray
*
lineStartEndPointsArray
=
[[
NSMutableArray
alloc
]
init
];
int
last_x
=
0
;
int
last_y
=
0
;
CGFloat
inflexionWidth
=
chartData
.
inflexionPointWidth
;
...
...
@@ -360,6 +360,9 @@
[
progressline
moveToPoint
:
CGPointMake
(
last_x1
,
last_y1
)];
[
progressline
addLineToPoint
:
CGPointMake
(
x1
,
y1
)];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
last_x1
,
last_y1
)]];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x1
,
y1
)]];
}
last_x
=
x
;
...
...
@@ -388,6 +391,9 @@
[
progressline
moveToPoint
:
CGPointMake
(
last_x1
,
last_y1
)];
[
progressline
addLineToPoint
:
CGPointMake
(
x1
,
y1
)];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
last_x1
,
last_y1
)]];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x1
,
y1
)]];
}
last_x
=
x
;
...
...
@@ -417,6 +423,9 @@
[
progressline
moveToPoint
:
CGPointMake
(
last_x1
,
last_y1
)];
[
progressline
addLineToPoint
:
CGPointMake
(
x1
,
y1
)];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
last_x1
,
last_y1
)]];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x1
,
y1
)]];
}
last_x
=
x
;
...
...
@@ -426,16 +435,20 @@
if
(
i
!=
0
)
{
[
progressline
addLineToPoint
:
CGPointMake
(
x
,
y
)];
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x
,
y
)]];
}
[
progressline
moveToPoint
:
CGPointMake
(
x
,
y
)];
if
(
i
!=
chartData
.
itemCount
-
1
){
[
lineStartEndPointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x
,
y
)]];
}
}
[
linePointsArray
addObject
:[
NSValue
valueWithCGPoint
:
CGPointMake
(
x
,
y
)]];
}
[
pathPoints
addObject
:[
linePointsArray
copy
]];
[
pointsOfPath
addObject
:[
lineStartEndPointsArray
copy
]];
}
}
...
...
@@ -530,7 +543,7 @@
[
self
prepareYLabelsWithData
:
data
];
[
self
calculateChartPath
:
_chartPath
andPointsPath
:
_pointPath
andPathKeyPoints
:
_pathPoints
];
[
self
calculateChartPath
:
_chartPath
andPointsPath
:
_pointPath
andPathKeyPoints
:
_pathPoints
andPathStartEndPoints
:
_endPointsOfPath
];
for
(
NSUInteger
lineIndex
=
0
;
lineIndex
<
self
.
chartData
.
count
;
lineIndex
++
)
{
...
...
@@ -652,6 +665,7 @@
self
.
chartLineArray
=
[
NSMutableArray
new
];
_showLabel
=
YES
;
_pathPoints
=
[[
NSMutableArray
alloc
]
init
];
_endPointsOfPath
=
[[
NSMutableArray
alloc
]
init
];
self
.
userInteractionEnabled
=
YES
;
_yLabelNum
=
5
.
0
;
...
...
Please
register
or
login
to post a comment