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
2014-12-13 04:46:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5e2a809a4cb749d27b7cb3876a770770dd1fadbe
5e2a809a
1 parent
eecd4065
Add update x labels function
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
PNChart/PNLineChart.h
PNChart/PNLineChart.m
PNChartDemo/PCChartViewController.m
PNChart/PNLineChart.h
View file @
5e2a809
...
...
@@ -28,6 +28,7 @@
@property
(
nonatomic
)
NSArray
*
chartData
;
@property
(
nonatomic
)
NSMutableArray
*
pathPoints
;
@property
(
nonatomic
)
NSMutableArray
*
xChartLabels
;
@property
(
nonatomic
)
CGFloat
xLabelWidth
;
@property
(
nonatomic
)
UIFont
*
xLabelFont
;
@property
(
nonatomic
)
UIColor
*
xLabelColor
;
...
...
PNChart/PNLineChart.m
View file @
5e2a809
...
...
@@ -108,7 +108,14 @@
{
_xLabels
=
xLabels
;
_xLabelWidth
=
width
;
if
(
_xChartLabels
)
{
for
(
PNChartLabel
*
label
in
_xChartLabels
)
{
[
label
removeFromSuperview
];
}
}
else
{
_xChartLabels
=
[
NSMutableArray
new
];
}
NSString
*
labelText
;
if
(
_showLabel
)
{
...
...
@@ -123,6 +130,7 @@
label
.
text
=
labelText
;
[
self
setCustomStyleForXLabel
:
label
];
[
self
addSubview
:
label
];
[
_xChartLabels
addObject
:
label
];
}
}
}
...
...
PNChartDemo/PCChartViewController.m
View file @
5e2a809
...
...
@@ -75,7 +75,7 @@
// Line Chart #1
NSArray
*
data01Array
=
@[
@
30.1
,
@220.1
,
@106.4
,
@22.2
,
@136.2
,
@67.2
,
@36.2
];
NSArray
*
data01Array
=
@[
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
)
];
PNLineChartData
*
data01
=
[
PNLineChartData
new
];
data01
.
color
=
PNFreshGreen
;
data01
.
itemCount
=
data01Array
.
count
;
...
...
@@ -86,7 +86,7 @@
};
// Line Chart #2
NSArray
*
data02Array
=
@[
@
60.1
,
@120.1
,
@126.4
,
@102.2
,
@56.2
,
@87.2
,
@136.2
];
NSArray
*
data02Array
=
@[
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
),
@
(
arc4random
()
%
300
)
];
PNLineChartData
*
data02
=
[
PNLineChartData
new
];
data02
.
color
=
PNTwitterColor
;
data02
.
itemCount
=
data02Array
.
count
;
...
...
@@ -96,6 +96,7 @@
return
[
PNLineChartDataItem
dataItemWithY
:
yValue
];
};
[
self
.
lineChart
setXLabels
:@[
@"DEC 1"
,
@"DEC 2"
,
@"DEC 3"
,
@"DEC 4"
,
@"DEC 5"
,
@"DEC 6"
,
@"DEC 7"
]];
[
self
.
lineChart
updateChartData
:@[
data01
,
data02
]];
}
...
...
Please
register
or
login
to post a comment