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 06:22:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a13a562ee0bedafc1ac9ced4d723d5262b4ae59
1a13a562
1 parent
4bbca5a1
Hide change value button on pie chart
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
31 deletions
PNChartDemo/Base.lproj/Main.storyboard
PNChartDemo/PCChartViewController.h
PNChartDemo/PCChartViewController.m
PNChartDemo/PCChartsTableViewController.h
PNChartDemo/PCChartsTableViewController.m
PNChartDemo/Base.lproj/Main.storyboard
View file @
1a13a56
...
...
@@ -43,6 +43,7 @@
</view>
<navigationItem
key=
"navigationItem"
title=
"PNChart"
id=
"Ukg-Sg-E2z"
/>
<connections>
<outlet
property=
"changeValueButton"
destination=
"L3F-13-Wf5"
id=
"JnI-y3-Xpj"
/>
<outlet
property=
"titleLabel"
destination=
"FUU-vZ-jMd"
id=
"dA3-KC-Ht4"
/>
</connections>
</viewController>
...
...
PNChartDemo/PCChartViewController.h
View file @
1a13a56
...
...
@@ -15,8 +15,11 @@
@property
(
nonatomic
)
PNLineChart
*
lineChart
;
@property
(
nonatomic
)
PNBarChart
*
barChart
;
@property
(
nonatomic
)
PNCircleChart
*
circleChart
;
@property
(
nonatomic
)
PNPieChart
*
pieChart
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
titleLabel
;
-
(
IBAction
)
changeValue
:(
id
)
sender
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
changeValueButton
;
@end
...
...
PNChartDemo/PCChartViewController.m
View file @
1a13a56
...
...
@@ -101,6 +101,25 @@
[
self
.
view
addSubview
:
self
.
circleChart
];
}
else
if
([
self
.
title
isEqualToString
:
@"Pie Chart"
])
{
self
.
titleLabel
.
text
=
@"Pie Chart"
;
NSArray
*
items
=
@[[
PNPieChartDataItem
dataItemWithValue
:
10
color
:
PNLightGreen
],
[
PNPieChartDataItem
dataItemWithValue
:
20
color
:
PNFreshGreen
description
:
@"WWDC"
],
[
PNPieChartDataItem
dataItemWithValue
:
40
color
:
PNDeepGreen
description
:
@"GOOG I/O"
],
];
self
.
pieChart
=
[[
PNPieChart
alloc
]
initWithFrame
:
CGRectMake
(
SCREEN_WIDTH
/
2
.
0
-
100
,
135
,
200
.
0
,
200
.
0
)
items
:
items
];
self
.
pieChart
.
descriptionTextColor
=
[
UIColor
whiteColor
];
self
.
pieChart
.
descriptionTextFont
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
11
.
0
];
self
.
pieChart
.
descriptionTextShadowColor
=
[
UIColor
clearColor
];
[
self
.
pieChart
strokeChart
];
[
self
.
view
addSubview
:
self
.
pieChart
];
self
.
changeValueButton
.
hidden
=
YES
;
}
}
...
...
PNChartDemo/PCChartsTableViewController.h
View file @
1a13a56
...
...
@@ -7,9 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "PNChartDelegate.h"
#import "PNChart.h"
@interface
PCChartsTableViewController
:
UITableViewController
<
PNChartDelegate
>
@interface
PCChartsTableViewController
:
UITableViewController
@end
...
...
PNChartDemo/PCChartsTableViewController.m
View file @
1a13a56
...
...
@@ -38,39 +38,11 @@
}
else
if
([
segue
.
identifier
isEqualToString
:
@"pieChart"
])
{
//Add pie chart
UILabel
*
pieChartLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
90
,
SCREEN_WIDTH
,
30
)];
pieChartLabel
.
text
=
@"Pie Chart"
;
pieChartLabel
.
textColor
=
PNFreshGreen
;
pieChartLabel
.
font
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
23
.
0
];
pieChartLabel
.
textAlignment
=
NSTextAlignmentCenter
;
NSArray
*
items
=
@[[
PNPieChartDataItem
dataItemWithValue
:
10
color
:
PNLightGreen
],
[
PNPieChartDataItem
dataItemWithValue
:
20
color
:
PNFreshGreen
description
:
@"WWDC"
],
[
PNPieChartDataItem
dataItemWithValue
:
40
color
:
PNDeepGreen
description
:
@"GOOG I/O"
],
];
PNPieChart
*
pieChart
=
[[
PNPieChart
alloc
]
initWithFrame
:
CGRectMake
(
SCREEN_WIDTH
/
2
.
0
-
100
,
135
,
200
.
0
,
200
.
0
)
items
:
items
];
pieChart
.
descriptionTextColor
=
[
UIColor
whiteColor
];
pieChart
.
descriptionTextFont
=
[
UIFont
fontWithName
:
@"Avenir-Medium"
size
:
11
.
0
];
pieChart
.
descriptionTextShadowColor
=
[
UIColor
clearColor
];
[
pieChart
strokeChart
];
[
viewController
.
view
addSubview
:
pieChartLabel
];
[
viewController
.
view
addSubview
:
pieChart
];
viewController
.
title
=
@"Pie Chart"
;
}
}
-
(
void
)
userClickedOnLineKeyPoint
:(
CGPoint
)
point
lineIndex
:(
NSInteger
)
lineIndex
pointIndex
:(
NSInteger
)
pointIndex
{
NSLog
(
@"Click Key on line %f, %f line index is %d and point index is %d"
,
point
.
x
,
point
.
y
,(
int
)
lineIndex
,
(
int
)
pointIndex
);
}
-
(
void
)
userClickedOnLinePoint
:(
CGPoint
)
point
lineIndex
:(
NSInteger
)
lineIndex
{
NSLog
(
@"Click on line %f, %f, line index is %d"
,
point
.
x
,
point
.
y
,
(
int
)
lineIndex
);
}
@end
...
...
Please
register
or
login
to post a comment