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
2014-12-03 20:24:24 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
db46cd416087b9cf6b472e3db6d21c1f93ab90b8
db46cd41
2 parents
210672e8
f6071f03
Merge pull request #119 from MrWooJ/fixing-Issue#70
Fixing issue#70
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
PNChart/PNLineChart.m
PNChart/PNLineChartData.h
PNChartDemo/PCChartsTableViewController.m
PNChart/PNLineChart.m
View file @
db46cd4
...
...
@@ -331,6 +331,36 @@
last_x
=
x
;
last_y
=
y
;
}
// Triangle point
else
if
(
chartData
.
inflexionPointStyle
==
PNLineChartPointStyleTriangle
)
{
CGRect
squareRect
=
CGRectMake
(
x
-
inflexionWidth
/
2
,
y
-
inflexionWidth
/
2
,
inflexionWidth
,
inflexionWidth
);
CGPoint
startPoint
=
CGPointMake
(
squareRect
.
origin
.
x
,
squareRect
.
origin
.
y
+
squareRect
.
size
.
height
);
CGPoint
endPoint
=
CGPointMake
(
squareRect
.
origin
.
x
+
(
squareRect
.
size
.
width
/
2
)
,
squareRect
.
origin
.
y
);
CGPoint
middlePoint
=
CGPointMake
(
squareRect
.
origin
.
x
+
(
squareRect
.
size
.
width
)
,
squareRect
.
origin
.
y
+
squareRect
.
size
.
height
);
[
pointPath
moveToPoint
:
startPoint
];
[
pointPath
addLineToPoint
:
middlePoint
];
[
pointPath
addLineToPoint
:
endPoint
];
[
pointPath
closePath
];
if
(
i
!=
0
)
{
// calculate the point for triangle
float
distance
=
sqrt
(
pow
(
x
-
last_x
,
2
)
+
pow
(
y
-
last_y
,
2
)
)
*
1
.
4
;
float
last_x1
=
last_x
+
(
inflexionWidth
/
2
)
/
distance
*
(
x
-
last_x
);
float
last_y1
=
last_y
+
(
inflexionWidth
/
2
)
/
distance
*
(
y
-
last_y
);
float
x1
=
x
-
(
inflexionWidth
/
2
)
/
distance
*
(
x
-
last_x
);
float
y1
=
y
-
(
inflexionWidth
/
2
)
/
distance
*
(
y
-
last_y
);
[
progressline
moveToPoint
:
CGPointMake
(
last_x1
,
last_y1
)];
[
progressline
addLineToPoint
:
CGPointMake
(
x1
,
y1
)];
}
last_x
=
x
;
last_y
=
y
;
}
else
{
if
(
i
!=
0
)
{
...
...
PNChart/PNLineChartData.h
View file @
db46cd4
...
...
@@ -8,7 +8,8 @@
typedef
NS_ENUM
(
NSUInteger
,
PNLineChartPointStyle
)
{
PNLineChartPointStyleNone
=
0
,
PNLineChartPointStyleCircle
=
1
,
PNLineChartPointStyleSquare
=
3
PNLineChartPointStyleSquare
=
3
,
PNLineChartPointStyleTriangle
=
4
};
@class
PNLineChartDataItem
;
...
...
PNChartDemo/PCChartsTableViewController.m
View file @
db46cd4
...
...
@@ -38,7 +38,7 @@
PNLineChartData
*
data01
=
[
PNLineChartData
new
];
data01
.
color
=
PNFreshGreen
;
data01
.
itemCount
=
lineChart
.
xLabels
.
count
;
data01
.
inflexionPointStyle
=
PNLineChartPointStyle
Circ
le
;
data01
.
inflexionPointStyle
=
PNLineChartPointStyle
Triang
le
;
data01
.
getData
=
^
(
NSUInteger
index
)
{
CGFloat
yValue
=
[
data01Array
[
index
]
floatValue
];
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
...
...
Please
register
or
login
to post a comment