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
xujunwen
2014-05-28 20:24:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0cb78e589023a4c6a680a9fcd4d9e3b4215717cd
0cb78e58
1 parent
a45ea1e6
PNLineChart's inflexion Point support two sharp, such as cycle, square
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
4 deletions
PNChart/PNLineChart/PNLineChart.h
PNChart/PNLineChart/PNLineChart.m
PNChart/PNLineChart/PNLineChartData.h
PNChart/PNLineChart/PNLineChartData.m
PNChartDemo/PCChartsTableViewController.m
PNChart/PNLineChart/PNLineChart.h
View file @
0cb78e5
...
...
@@ -10,7 +10,6 @@
#import <QuartzCore/QuartzCore.h>
#import "PNChartDelegate.h"
@interface
PNLineChart
:
UIView
/**
...
...
@@ -48,8 +47,6 @@
@property
(
nonatomic
)
CGFloat
chartMargin
;
@property
(
nonatomic
)
BOOL
showLabel
;
...
...
PNChart/PNLineChart/PNLineChart.m
View file @
0cb78e5
This diff is collapsed. Click to expand it.
PNChart/PNLineChart/PNLineChartData.h
View file @
0cb78e5
...
...
@@ -5,14 +5,36 @@
#import <Foundation/Foundation.h>
/**
* not support PNLineChartPointStyleTriangle style recently
*/
typedef
NS_ENUM
(
NSUInteger
,
PNLineChartPointStyle
)
{
PNLineChartPointStyleNone
=
0
,
PNLineChartPointStyleCycle
,
PNLineChartPointStyleTriangle
,
PNLineChartPointStyleSquare
};
@class
PNLineChartDataItem
;
typedef
PNLineChartDataItem
*
(
^
LCLineChartDataGetter
)(
NSUInteger
item
);
@interface
PNLineChartData
:
NSObject
@property
(
strong
)
UIColor
*
color
;
@property
NSUInteger
itemCount
;
@property
(
copy
)
LCLineChartDataGetter
getData
;
@property
(
nonatomic
,
assign
)
PNLineChartPointStyle
inflexionPointStyle
;
/**
* if PNLineChartPointStyle is cycle, inflexionPointWidth equal cycle's diameter
* if PNLineChartPointStyle is square, that means the foundation is square with
* inflexionPointWidth long
*/
@property
(
nonatomic
,
assign
)
CGFloat
inflexionPointWidth
;
@property
(
nonatomic
,
assign
)
CGFloat
lineWidth
;
@end
...
...
PNChart/PNLineChart/PNLineChartData.m
View file @
0cb78e5
...
...
@@ -7,4 +7,22 @@
@implementation
PNLineChartData
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
)
{
[
self
setDefaultValues
];
}
return
self
;
}
-
(
void
)
setDefaultValues
{
_inflexionPointStyle
=
PNLineChartPointStyleNone
;
_inflexionPointWidth
=
6
.
f
;
_lineWidth
=
2
.
f
;
}
@end
...
...
PNChartDemo/PCChartsTableViewController.m
View file @
0cb78e5
...
...
@@ -64,12 +64,14 @@
lineChart
.
yLabelFormat
=
@"%1.1f"
;
lineChart
.
backgroundColor
=
[
UIColor
clearColor
];
[
lineChart
setXLabels
:@[
@"SEP 1"
,
@"SEP 2"
,
@"SEP 3"
,
@"SEP 4"
,
@"SEP 5"
,
@"SEP 6"
,
@"SEP 7"
]];
lineChart
.
showCoordinateAxis
=
YES
;
// Line Chart Nr.1
NSArray
*
data01Array
=
@[
@60.1
,
@160.1
,
@126.4
,
@262.2
,
@186.2
,
@127.2
,
@176.2
];
PNLineChartData
*
data01
=
[
PNLineChartData
new
];
data01
.
color
=
PNFreshGreen
;
data01
.
itemCount
=
lineChart
.
xLabels
.
count
;
data01
.
inflexionPointStyle
=
PNLineChartPointStyleCycle
;
data01
.
getData
=
^
(
NSUInteger
index
)
{
CGFloat
yValue
=
[
data01Array
[
index
]
floatValue
];
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
...
...
@@ -80,6 +82,7 @@
PNLineChartData
*
data02
=
[
PNLineChartData
new
];
data02
.
color
=
PNTwitterColor
;
data02
.
itemCount
=
lineChart
.
xLabels
.
count
;
data02
.
inflexionPointStyle
=
PNLineChartPointStyleSquare
;
data02
.
getData
=
^
(
NSUInteger
index
)
{
CGFloat
yValue
=
[
data02Array
[
index
]
floatValue
];
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
...
...
Please
register
or
login
to post a comment