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
2013-11-16 07:54:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4c9f7a17b0d5d83877f7c4010c304b942dace33b
4c9f7a17
1 parent
bca4c81c
Fix #8 #5 and #6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
PNChartDemo/PCChartViewController.m
PNChartDemo/PNChart/PNBarChart.m
PNChartDemo/PNChart/PNLineChart.m
PNChartDemo/PCChartViewController.m
View file @
4c9f7a1
...
...
@@ -28,8 +28,8 @@
PNChart
*
lineChart
=
[[
PNChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
75
.
0
,
SCREEN_WIDTH
,
200
.
0
)];
lineChart
.
backgroundColor
=
[
UIColor
clearColor
];
[
lineChart
setXLabels
:@[
@"SEP 1"
,
@"SEP 2"
,
@"SEP 3"
,
@"SEP 4"
,
@"SEP 5"
]];
[
lineChart
setYValues
:@[
@
"1"
,
@"240"
,
@"122"
,
@"186"
,
@"300"
]];
[
lineChart
setXLabels
:@[
@"SEP 1"
,
@"SEP 2"
,
@"SEP 3"
,
@"SEP 4"
,
@"SEP 5"
,
@"SEP 6"
,
@"SEP 7"
]];
[
lineChart
setYValues
:@[
@
1
,
@24
,
@12
,
@18
,
@30
,
@10
,
@21
]];
[
lineChart
strokeChart
];
[
self
.
chartScrollView
addSubview
:
lineChartLabel
];
[
self
.
chartScrollView
addSubview
:
lineChart
];
...
...
@@ -45,8 +45,8 @@
PNChart
*
barChart
=
[[
PNChart
alloc
]
initWithFrame
:
CGRectMake
(
0
,
335
.
0
,
SCREEN_WIDTH
,
200
.
0
)];
barChart
.
backgroundColor
=
[
UIColor
clearColor
];
barChart
.
type
=
PNBarType
;
[
barChart
setXLabels
:@[
@"SEP 1"
,
@"SEP 2"
,
@"SEP 3"
,
@"SEP 4"
,
@"SEP 5"
]];
[
barChart
setYValues
:@[
@
"1"
,
@"240"
,
@"122"
,
@"186"
,
@"300"
]];
[
barChart
setXLabels
:@[
@"SEP 1"
,
@"SEP 2"
,
@"SEP 3"
,
@"SEP 4"
,
@"SEP 5"
,
@"SEP 6"
,
@"SEP 7"
]];
[
barChart
setYValues
:@[
@
1
,
@24
,
@12
,
@18
,
@30
,
@10
,
@21
]];
[
barChart
strokeChart
];
[
self
.
chartScrollView
addSubview
:
barChartLabel
];
[
self
.
chartScrollView
addSubview
:
barChart
];
...
...
PNChartDemo/PNChart/PNBarChart.m
View file @
4c9f7a1
...
...
@@ -58,7 +58,7 @@
-
(
void
)
setXLabels
:(
NSArray
*
)
xLabels
{
_xLabels
=
xLabels
;
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
*
2
)
/
5
.
0
;
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
*
2
)
/
[
xLabels
count
]
;
for
(
NSString
*
labelText
in
xLabels
)
{
NSInteger
index
=
[
xLabels
indexOfObject
:
labelText
];
...
...
PNChartDemo/PNChart/PNLineChart.m
View file @
4c9f7a1
...
...
@@ -55,7 +55,7 @@
_yValueMax
=
(
int
)
max
;
float
level
=
max
/
5
.
0
;
float
level
=
max
/
[
yLabels
count
]
;
NSInteger
index
=
0
;
NSInteger
num
=
[
yLabels
count
]
+
1
;
...
...
@@ -75,7 +75,7 @@
-
(
void
)
setXLabels
:(
NSArray
*
)
xLabels
{
_xLabels
=
xLabels
;
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
-
30
.
0
-
([
xLabels
count
]
-
1
)
*
xLabelMargin
)
/
5
.
0
;
_xLabelWidth
=
(
self
.
frame
.
size
.
width
-
chartMargin
-
30
.
0
-
([
xLabels
count
]
-
1
)
*
xLabelMargin
)
/
[
xLabels
count
]
;
for
(
NSString
*
labelText
in
xLabels
)
{
NSInteger
index
=
[
xLabels
indexOfObject
:
labelText
];
...
...
Please
register
or
login
to post a comment