kevin

Change demo style

@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8BD182AEB99003645C4 /* PNColor.m */; }; 30 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8BD182AEB99003645C4 /* PNColor.m */; };
31 9F55483E18498E0E004073B5 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F55483D18498E0E004073B5 /* PNCircleChart.m */; }; 31 9F55483E18498E0E004073B5 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F55483D18498E0E004073B5 /* PNCircleChart.m */; };
32 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F656B50184A4E34002E5675 /* UICountingLabel.m */; }; 32 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F656B50184A4E34002E5675 /* UICountingLabel.m */; };
  33 + 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */; };
33 /* End PBXBuildFile section */ 34 /* End PBXBuildFile section */
34 35
35 /* Begin PBXContainerItemProxy section */ 36 /* Begin PBXContainerItemProxy section */
@@ -79,6 +80,8 @@ @@ -79,6 +80,8 @@
79 9F55483D18498E0E004073B5 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PNCircleChart.m; path = PNChart/PNCircleChart.m; sourceTree = "<group>"; }; 80 9F55483D18498E0E004073B5 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PNCircleChart.m; path = PNChart/PNCircleChart.m; sourceTree = "<group>"; };
80 9F656B4F184A4E34002E5675 /* UICountingLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UICountingLabel.h; path = PNChart/ThirdPart/UICountingLabel.h; sourceTree = "<group>"; }; 81 9F656B4F184A4E34002E5675 /* UICountingLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UICountingLabel.h; path = PNChart/ThirdPart/UICountingLabel.h; sourceTree = "<group>"; };
81 9F656B50184A4E34002E5675 /* UICountingLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UICountingLabel.m; path = PNChart/ThirdPart/UICountingLabel.m; sourceTree = "<group>"; }; 82 9F656B50184A4E34002E5675 /* UICountingLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UICountingLabel.m; path = PNChart/ThirdPart/UICountingLabel.m; sourceTree = "<group>"; };
  83 + 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartsTableViewController.h; sourceTree = "<group>"; };
  84 + 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartsTableViewController.m; sourceTree = "<group>"; };
82 /* End PBXFileReference section */ 85 /* End PBXFileReference section */
83 86
84 /* Begin PBXFrameworksBuildPhase section */ 87 /* Begin PBXFrameworksBuildPhase section */
@@ -198,6 +201,8 @@ @@ -198,6 +201,8 @@
198 children = ( 201 children = (
199 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */, 202 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */,
200 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */, 203 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */,
  204 + 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */,
  205 + 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */,
201 ); 206 );
202 name = PCChartViewController; 207 name = PCChartViewController;
203 sourceTree = "<group>"; 208 sourceTree = "<group>";
@@ -345,6 +350,7 @@ @@ -345,6 +350,7 @@
345 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, 350 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */,
346 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */, 351 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */,
347 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */, 352 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */,
  353 + 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */,
348 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */, 354 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */,
349 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */, 355 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */,
350 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */, 356 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */,
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="Tha-Wr-sPW"> 2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A2093" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="9Rt-UT-IxH">
3 <dependencies> 3 <dependencies>
4 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/> 4 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
5 </dependencies> 5 </dependencies>
6 <scenes> 6 <scenes>
7 <!--Chart View Controller - PNChart--> 7 <!--Chart View Controller - PNChart-->
@@ -15,40 +15,109 @@ @@ -15,40 +15,109 @@
15 <view key="view" contentMode="scaleToFill" id="PPb-b8-nBo"> 15 <view key="view" contentMode="scaleToFill" id="PPb-b8-nBo">
16 <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> 16 <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
17 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> 17 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18 - <subviews> 18 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
19 - <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zzj-XM-Ti3"> 19 + </view>
  20 + <navigationItem key="navigationItem" title="PNChart" id="Ukg-Sg-E2z"/>
  21 + </viewController>
  22 + <placeholder placeholderIdentifier="IBFirstResponder" id="kDa-u3-t6i" userLabel="First Responder" sceneMemberID="firstResponder"/>
  23 + </objects>
  24 + <point key="canvasLocation" x="536" y="31"/>
  25 + </scene>
  26 + <!--Charts Table View Controller - PNChart-->
  27 + <scene sceneID="pBo-qW-N8B">
  28 + <objects>
  29 + <tableViewController id="cc5-BF-Ga2" customClass="PCChartsTableViewController" sceneMemberID="viewController">
  30 + <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="EAk-8x-zLw">
20 <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> 31 <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
21 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 32 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  33 + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
  34 + <sections>
  35 + <tableViewSection id="Rtv-33-iAC">
  36 + <cells>
  37 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="dtA-8k-dgn" style="IBUITableViewCellStyleDefault" id="irc-98-Qkg">
  38 + <rect key="frame" x="0.0" y="64" width="320" height="44"/>
  39 + <autoresizingMask key="autoresizingMask"/>
  40 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="irc-98-Qkg" id="QVQ-E4-AgU">
  41 + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
  42 + <autoresizingMask key="autoresizingMask"/>
22 <subviews> 43 <subviews>
23 - <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hEz-YM-aHu"> 44 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="LineChart" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dtA-8k-dgn">
24 - <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> 45 + <rect key="frame" x="15" y="0.0" width="270" height="43"/>
25 - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 46 + <autoresizingMask key="autoresizingMask"/>
26 - </scrollView> 47 + <fontDescription key="fontDescription" type="system" pointSize="18"/>
  48 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  49 + <nil key="highlightedColor"/>
  50 + </label>
  51 + </subviews>
  52 + </tableViewCellContentView>
  53 + <connections>
  54 + <segue destination="Tha-Wr-sPW" kind="push" identifier="lineChart" id="XHj-XM-h67"/>
  55 + </connections>
  56 + </tableViewCell>
  57 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="sGJ-nJ-Evy" style="IBUITableViewCellStyleDefault" id="uiU-qo-XNI">
  58 + <rect key="frame" x="0.0" y="108" width="320" height="44"/>
  59 + <autoresizingMask key="autoresizingMask"/>
  60 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="uiU-qo-XNI" id="QSW-pF-BtE">
  61 + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
  62 + <autoresizingMask key="autoresizingMask"/>
  63 + <subviews>
  64 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="BarChart" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sGJ-nJ-Evy">
  65 + <rect key="frame" x="15" y="0.0" width="270" height="43"/>
  66 + <autoresizingMask key="autoresizingMask"/>
  67 + <fontDescription key="fontDescription" type="system" pointSize="18"/>
  68 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  69 + <nil key="highlightedColor"/>
  70 + </label>
27 </subviews> 71 </subviews>
28 - </scrollView> 72 + </tableViewCellContentView>
  73 + <connections>
  74 + <segue destination="Tha-Wr-sPW" kind="push" identifier="barChart" id="BAm-LA-QbM"/>
  75 + </connections>
  76 + </tableViewCell>
  77 + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="Bn9-8g-5UP" style="IBUITableViewCellStyleDefault" id="xKf-5i-9cT">
  78 + <rect key="frame" x="0.0" y="152" width="320" height="44"/>
  79 + <autoresizingMask key="autoresizingMask"/>
  80 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xKf-5i-9cT" id="0Fm-qD-hZk">
  81 + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
  82 + <autoresizingMask key="autoresizingMask"/>
  83 + <subviews>
  84 + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="CircleChart" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Bn9-8g-5UP">
  85 + <rect key="frame" x="15" y="0.0" width="270" height="43"/>
  86 + <autoresizingMask key="autoresizingMask"/>
  87 + <fontDescription key="fontDescription" type="system" pointSize="18"/>
  88 + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
  89 + <nil key="highlightedColor"/>
  90 + </label>
29 </subviews> 91 </subviews>
30 - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> 92 + </tableViewCellContentView>
31 - </view>  
32 - <navigationItem key="navigationItem" title="PNChart" id="Ukg-Sg-E2z"/>  
33 <connections> 93 <connections>
34 - <outlet property="chartScrollView" destination="hEz-YM-aHu" id="FNY-KI-LWB"/> 94 + <segue destination="Tha-Wr-sPW" kind="push" identifier="circleChart" id="WSA-oe-ed1"/>
35 </connections> 95 </connections>
36 - </viewController> 96 + </tableViewCell>
37 - <placeholder placeholderIdentifier="IBFirstResponder" id="kDa-u3-t6i" userLabel="First Responder" sceneMemberID="firstResponder"/> 97 + </cells>
  98 + </tableViewSection>
  99 + </sections>
  100 + </tableView>
  101 + <navigationItem key="navigationItem" title="PNChart" id="wPu-Ht-gOr"/>
  102 + </tableViewController>
  103 + <placeholder placeholderIdentifier="IBFirstResponder" id="JMX-8U-h8G" userLabel="First Responder" sceneMemberID="firstResponder"/>
38 </objects> 104 </objects>
39 - <point key="canvasLocation" x="122" y="77"/> 105 + <point key="canvasLocation" x="50" y="31"/>
40 </scene> 106 </scene>
41 <!--Navigation Controller--> 107 <!--Navigation Controller-->
42 - <scene sceneID="reF-4Z-6Lj"> 108 + <scene sceneID="adz-gG-u3z">
43 <objects> 109 <objects>
44 - <navigationController definesPresentationContext="YES" id="vvA-tN-hei" sceneMemberID="viewController"> 110 + <navigationController definesPresentationContext="YES" id="9Rt-UT-IxH" sceneMemberID="viewController">
45 - <navigationBar key="navigationBar" contentMode="scaleToFill" id="a96-uI-oQT"> 111 + <navigationBar key="navigationBar" contentMode="scaleToFill" id="Vgs-8d-rE2">
46 <autoresizingMask key="autoresizingMask"/> 112 <autoresizingMask key="autoresizingMask"/>
47 </navigationBar> 113 </navigationBar>
  114 + <connections>
  115 + <segue destination="cc5-BF-Ga2" kind="relationship" relationship="rootViewController" id="Jdg-FU-XfU"/>
  116 + </connections>
48 </navigationController> 117 </navigationController>
49 - <placeholder placeholderIdentifier="IBFirstResponder" id="Wms-Sd-p8B" userLabel="First Responder" sceneMemberID="firstResponder"/> 118 + <placeholder placeholderIdentifier="IBFirstResponder" id="RN0-OP-dIr" userLabel="First Responder" sceneMemberID="firstResponder"/>
50 </objects> 119 </objects>
51 - <point key="canvasLocation" x="-461" y="92"/> 120 + <point key="canvasLocation" x="-318" y="31"/>
52 </scene> 121 </scene>
53 </scenes> 122 </scenes>
54 <simulatedMetricsContainer key="defaultSimulatedMetrics"> 123 <simulatedMetricsContainer key="defaultSimulatedMetrics">
@@ -56,4 +125,7 @@ @@ -56,4 +125,7 @@
56 <simulatedOrientationMetrics key="orientation"/> 125 <simulatedOrientationMetrics key="orientation"/>
57 <simulatedScreenMetrics key="destination" type="retina4"/> 126 <simulatedScreenMetrics key="destination" type="retina4"/>
58 </simulatedMetricsContainer> 127 </simulatedMetricsContainer>
  128 + <inferredMetricsTieBreakers>
  129 + <segue reference="XHj-XM-h67"/>
  130 + </inferredMetricsTieBreakers>
59 </document> 131 </document>
@@ -9,6 +9,6 @@ @@ -9,6 +9,6 @@
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
11 @interface PCChartViewController : UIViewController 11 @interface PCChartViewController : UIViewController
12 -@property (weak, nonatomic) IBOutlet UIScrollView *chartScrollView; 12 +
13 13
14 @end 14 @end
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 // 7 //
8 8
9 #import "PCChartViewController.h" 9 #import "PCChartViewController.h"
10 -#import "PNChart.h" 10 +
11 11
12 @interface PCChartViewController () 12 @interface PCChartViewController ()
13 13
@@ -19,61 +19,14 @@ @@ -19,61 +19,14 @@
19 { 19 {
20 [super viewDidLoad]; 20 [super viewDidLoad];
21 21
22 - //Add LineChart  
23 - UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, SCREEN_WIDTH, 30)];  
24 - lineChartLabel.text = @"Line Chart";  
25 - lineChartLabel.textColor = PNFreshGreen;  
26 - lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];  
27 - lineChartLabel.textAlignment = NSTextAlignmentCenter;  
28 -  
29 - PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 75.0, SCREEN_WIDTH, 200.0)];  
30 - lineChart.backgroundColor = [UIColor clearColor];  
31 - [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];  
32 - [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];  
33 - [lineChart strokeChart];  
34 - [self.chartScrollView addSubview:lineChartLabel];  
35 - [self.chartScrollView addSubview:lineChart];  
36 -  
37 - //Add BarChart  
38 -  
39 - UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, SCREEN_WIDTH, 30)];  
40 - barChartLabel.text = @"Bar Chart";  
41 - barChartLabel.textColor = PNFreshGreen;  
42 - barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];  
43 - barChartLabel.textAlignment = NSTextAlignmentCenter;  
44 -  
45 - PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 335.0, SCREEN_WIDTH, 200.0)];  
46 - barChart.backgroundColor = [UIColor clearColor];  
47 - barChart.type = PNBarType;  
48 - [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];  
49 - [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];  
50 - [barChart strokeChart];  
51 - [self.chartScrollView addSubview:barChartLabel];  
52 - [self.chartScrollView addSubview:barChart];  
53 -  
54 - //Add CircleChart  
55 -  
56 -  
57 - UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 550, SCREEN_WIDTH, 30)];  
58 - circleChartLabel.text = @"Circle Chart";  
59 - circleChartLabel.textColor = PNFreshGreen;  
60 - circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];  
61 - circleChartLabel.textAlignment = NSTextAlignmentCenter;  
62 -  
63 - PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 585.0, SCREEN_WIDTH, 200.0)];  
64 - circleChart.backgroundColor = [UIColor clearColor];  
65 - circleChart.type = PNCircleType;  
66 - circleChart.total = [NSNumber numberWithInt:100];  
67 - circleChart.current = [NSNumber numberWithInt:60];  
68 - [circleChart strokeChart];  
69 - [self.chartScrollView addSubview:circleChartLabel];  
70 - [self.chartScrollView addSubview:circleChart];  
71 -  
72 - [self.chartScrollView setContentSize:CGSizeMake(SCREEN_WIDTH, 900.0)];  
73 -  
74 // Do any additional setup after loading the view. 22 // Do any additional setup after loading the view.
75 } 23 }
76 24
  25 +- (void)viewWillAppear:(BOOL)animated
  26 +{
  27 + [super viewWillAppear:animated];
  28 +}
  29 +
77 - (void)didReceiveMemoryWarning 30 - (void)didReceiveMemoryWarning
78 { 31 {
79 [super didReceiveMemoryWarning]; 32 [super didReceiveMemoryWarning];
  1 +//
  2 +// PCChartsTableViewController.h
  3 +// PNChartDemo
  4 +//
  5 +// Created by kevinzhow on 13-12-1.
  6 +// Copyright (c) 2013年 kevinzhow. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface PCChartsTableViewController : UITableViewController
  12 +
  13 +@end
  1 +//
  2 +// PCChartsTableViewController.m
  3 +// PNChartDemo
  4 +//
  5 +// Created by kevinzhow on 13-12-1.
  6 +// Copyright (c) 2013年 kevinzhow. All rights reserved.
  7 +//
  8 +
  9 +#import "PCChartsTableViewController.h"
  10 +#import "PNChart.h"
  11 +
  12 +@interface PCChartsTableViewController ()
  13 +
  14 +@end
  15 +
  16 +@implementation PCChartsTableViewController
  17 +
  18 +- (id)initWithStyle:(UITableViewStyle)style
  19 +{
  20 + self = [super initWithStyle:style];
  21 + if (self) {
  22 + // Custom initialization
  23 + }
  24 + return self;
  25 +}
  26 +
  27 +- (void)viewDidLoad
  28 +{
  29 + [super viewDidLoad];
  30 +
  31 + // Uncomment the following line to preserve selection between presentations.
  32 + // self.clearsSelectionOnViewWillAppear = NO;
  33 +
  34 + // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
  35 + // self.navigationItem.rightBarButtonItem = self.editButtonItem;
  36 +}
  37 +
  38 +- (void)didReceiveMemoryWarning
  39 +{
  40 + [super didReceiveMemoryWarning];
  41 + // Dispose of any resources that can be recreated.
  42 +}
  43 +
  44 +// In a story board-based application, you will often want to do a little preparation before navigation
  45 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  46 +{
  47 + // Get the new view controller using [segue destinationViewController].
  48 + // Pass the selected object to the new view controller.
  49 +
  50 + UIViewController * viewController = [segue destinationViewController];
  51 +
  52 + if ([segue.identifier isEqualToString:@"lineChart"]) {
  53 +
  54 + //Add LineChart
  55 + UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)];
  56 + lineChartLabel.text = @"Line Chart";
  57 + lineChartLabel.textColor = PNFreshGreen;
  58 + lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
  59 + lineChartLabel.textAlignment = NSTextAlignmentCenter;
  60 +
  61 + PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  62 + lineChart.backgroundColor = [UIColor clearColor];
  63 + [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
  64 + [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
  65 + [lineChart strokeChart];
  66 +
  67 + [viewController.view addSubview:lineChartLabel];
  68 + [viewController.view addSubview:lineChart];
  69 +
  70 + viewController.title = @"Line Chart";
  71 +
  72 + }else if ([segue.identifier isEqualToString:@"barChart"])
  73 + {
  74 + //Add BarChart
  75 +
  76 + UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)];
  77 + barChartLabel.text = @"Bar Chart";
  78 + barChartLabel.textColor = PNFreshGreen;
  79 + barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
  80 + barChartLabel.textAlignment = NSTextAlignmentCenter;
  81 +
  82 + PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  83 + barChart.backgroundColor = [UIColor clearColor];
  84 + barChart.type = PNBarType;
  85 + [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
  86 + [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
  87 + [barChart strokeChart];
  88 +
  89 + [viewController.view addSubview:barChartLabel];
  90 + [viewController.view addSubview:barChart];
  91 +
  92 + viewController.title = @"Bar Chart";
  93 + }else if ([segue.identifier isEqualToString:@"circleChart"])
  94 + {
  95 +
  96 + //Add CircleChart
  97 +
  98 +
  99 + UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)];
  100 + circleChartLabel.text = @"Circle Chart";
  101 + circleChartLabel.textColor = PNFreshGreen;
  102 + circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
  103 + circleChartLabel.textAlignment = NSTextAlignmentCenter;
  104 +
  105 + PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  106 + circleChart.backgroundColor = [UIColor clearColor];
  107 + circleChart.type = PNCircleType;
  108 + circleChart.total = [NSNumber numberWithInt:100];
  109 + circleChart.current = [NSNumber numberWithInt:60];
  110 + [circleChart strokeChart];
  111 +
  112 + [viewController.view addSubview:circleChartLabel];
  113 + [viewController.view addSubview:circleChart];
  114 +
  115 + viewController.title = @"Circle Chart";
  116 + }
  117 +
  118 +
  119 +
  120 +
  121 +
  122 +
  123 +}
  124 +
  125 +
  126 +@end