Showing
1 changed file
with
270 additions
and
9 deletions
| 1 | +# | ||
| 2 | +# Be sure to run `pod spec lint PNChart.podspec' to ensure this is a | ||
| 3 | +# valid spec and to remove all comments including this before submitting the spec. | ||
| 4 | +# | ||
| 5 | +# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html | ||
| 6 | +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
| 7 | +# | ||
| 8 | + | ||
| 1 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | + | ||
| 11 | + # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 12 | + # | ||
| 13 | + # These will help people to find your library, and whilst it | ||
| 14 | + # can feel like a chore to fill in it's definitely to your advantage. The | ||
| 15 | + # summary should be tweet-length, and the description more in depth. | ||
| 16 | + # | ||
| 17 | + | ||
| 2 | s.name = "PNChart" | 18 | s.name = "PNChart" |
| 3 | - s.version = "0.6.0" | 19 | + s.version = "0.5.5" |
| 4 | s.summary = "A simple and beautiful chart lib with animation used in Piner for iOS" | 20 | s.summary = "A simple and beautiful chart lib with animation used in Piner for iOS" |
| 5 | 21 | ||
| 22 | + s.description = <<-DESC | ||
| 23 | + #PNChart | ||
| 24 | + | ||
| 25 | + [](https://travis-ci.org/kevinzhow/PNChart) | ||
| 26 | + | ||
| 27 | + You can also find swift version at here https://github.com/kevinzhow/PNChart-Swift | ||
| 28 | + | ||
| 29 | + A simple and beautiful chart lib with **animation** used in [Piner](https://itunes.apple.com/us/app/piner/id637706410) and [CoinsMan](https://itunes.apple.com/us/app/coinsman/id772163893) for iOS | ||
| 30 | + | ||
| 31 | + [](https://dl.dropboxusercontent.com/u/1599662/pnchart.gif) | ||
| 32 | + | ||
| 33 | + ## Requirements | ||
| 34 | + | ||
| 35 | + PNChart works on iOS 6.0 and later version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates: | ||
| 36 | + | ||
| 37 | + * Foundation.framework | ||
| 38 | + * UIKit.framework | ||
| 39 | + * CoreGraphics.framework | ||
| 40 | + * QuartzCore.framework | ||
| 41 | + | ||
| 42 | + You will need LLVM 3.0 or later in order to build PNChart. | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + ## Usage | ||
| 48 | + | ||
| 49 | + ### Cocoapods | ||
| 50 | + | ||
| 51 | + [CocoaPods](http://cocoapods.org) is the recommended way to add PNChart to your project. | ||
| 52 | + | ||
| 53 | + 1. Add a pod entry for PNChart to your Podfile `pod 'PNChart', '~> 0.5'` | ||
| 54 | + 2. Install the pod(s) by running `pod install`. | ||
| 55 | + 3. Include PNChart wherever you need it with `#import "PNChart.h"`. | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + ### Copy the PNChart folder to your project | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + [](https://dl.dropboxusercontent.com/u/1599662/line.png) | ||
| 62 | + | ||
| 63 | + ```objective-c | ||
| 64 | + #import "PNChart.h" | ||
| 65 | + | ||
| 66 | + //For LineChart | ||
| 67 | + PNLineChart * lineChart = [[PNLineChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | ||
| 68 | + [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5"]]; | ||
| 69 | + | ||
| 70 | + // Line Chart No.1 | ||
| 71 | + NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2]; | ||
| 72 | + PNLineChartData *data01 = [PNLineChartData new]; | ||
| 73 | + data01.color = PNFreshGreen; | ||
| 74 | + data01.itemCount = lineChart.xLabels.count; | ||
| 75 | + data01.getData = ^(NSUInteger index) { | ||
| 76 | + CGFloat yValue = [data01Array[index] floatValue]; | ||
| 77 | + return [PNLineChartDataItem dataItemWithY:yValue]; | ||
| 78 | + }; | ||
| 79 | + // Line Chart No.2 | ||
| 80 | + NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2]; | ||
| 81 | + PNLineChartData *data02 = [PNLineChartData new]; | ||
| 82 | + data02.color = PNTwitterColor; | ||
| 83 | + data02.itemCount = lineChart.xLabels.count; | ||
| 84 | + data02.getData = ^(NSUInteger index) { | ||
| 85 | + CGFloat yValue = [data02Array[index] floatValue]; | ||
| 86 | + return [PNLineChartDataItem dataItemWithY:yValue]; | ||
| 87 | + }; | ||
| 88 | + | ||
| 89 | + lineChart.chartData = @[data01, data02]; | ||
| 90 | + [lineChart strokeChart]; | ||
| 91 | + | ||
| 92 | + ``` | ||
| 93 | + | ||
| 94 | + [](https://dl.dropboxusercontent.com/u/1599662/bar.png) | ||
| 95 | + | ||
| 96 | + ```objective-c | ||
| 97 | + #import "PNChart.h" | ||
| 98 | + | ||
| 99 | + //For BarChart | ||
| 100 | + PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | ||
| 101 | + [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5"]]; | ||
| 102 | + [barChart setYValues:@[@1, @10, @2, @6, @3]]; | ||
| 103 | + [barChart strokeChart]; | ||
| 104 | + | ||
| 105 | + ``` | ||
| 106 | + | ||
| 107 | + [](https://dl.dropboxusercontent.com/u/1599662/circle.png) | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + ```objective-c | ||
| 111 | + #import "PNChart.h" | ||
| 112 | + | ||
| 113 | + //For CircleChart | ||
| 114 | + | ||
| 115 | + PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) andTotal:[NSNumber numberWithInt:100] andCurrent:[NSNumber numberWithInt:60] andClockwise:NO]; | ||
| 116 | + circleChart.backgroundColor = [UIColor clearColor]; | ||
| 117 | + [circleChart setStrokeColor:PNGreen]; | ||
| 118 | + [circleChart strokeChart]; | ||
| 119 | + | ||
| 120 | + ``` | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + [](https://dl.dropboxusercontent.com/u/1599662/pie.png) | ||
| 124 | + | ||
| 125 | + ```objective-c | ||
| 126 | + # import "PNChart.h" | ||
| 127 | + //For PieChart | ||
| 128 | + NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNRed], | ||
| 129 | + [PNPieChartDataItem dataItemWithValue:20 color:PNBlue description:@"WWDC"], | ||
| 130 | + [PNPieChartDataItem dataItemWithValue:40 color:PNGreen description:@"GOOL I/O"], | ||
| 131 | + ]; | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + PNPieChart *pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(40.0, 155.0, 240.0, 240.0) items:items]; | ||
| 136 | + pieChart.descriptionTextColor = [UIColor whiteColor]; | ||
| 137 | + pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:14.0]; | ||
| 138 | + [pieChart strokeChart]; | ||
| 139 | + ``` | ||
| 140 | + | ||
| 141 | + #### Callback | ||
| 142 | + | ||
| 143 | + Currently callback only works on Linechart | ||
| 144 | + | ||
| 145 | + ```objective-c | ||
| 146 | + #import "PNChart.h" | ||
| 147 | + | ||
| 148 | + //For LineChart | ||
| 149 | + | ||
| 150 | + lineChart.delegate = self; | ||
| 151 | + | ||
| 152 | + | ||
| 153 | + ``` | ||
| 154 | + | ||
| 155 | + ```objective-c | ||
| 156 | + | ||
| 157 | + //For DelegateMethod | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + -(void)userClickedOnLineKeyPoint:(CGPoint)point lineIndex:(NSInteger)lineIndex pointIndex:(NSInteger)pointIndex{ | ||
| 161 | + NSLog(@"Click Key on line %f, %f line index is %d and point index is %d",point.x, point.y,(int)lineIndex, (int)pointIndex); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + -(void)userClickedOnLinePoint:(CGPoint)point lineIndex:(NSInteger)lineIndex{ | ||
| 165 | + NSLog(@"Click on line %f, %f, line index is %d",point.x, point.y, (int)lineIndex); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + ``` | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + ## License | ||
| 172 | + | ||
| 173 | + This code is distributed under the terms and conditions of the [MIT license](LICENSE). | ||
| 174 | + | ||
| 175 | + ## SpecialThanks | ||
| 176 | + | ||
| 177 | + [@lexrus](http://twitter.com/lexrus) CocoaPods Spec | ||
| 178 | + | ||
| 179 | + DESC | ||
| 180 | + | ||
| 6 | s.homepage = "https://github.com/kevinzhow/PNChart" | 181 | s.homepage = "https://github.com/kevinzhow/PNChart" |
| 7 | - s.screenshots = "https://github-camo.global.ssl.fastly.net/ea8565b7a726409d5966ff4bcb8c4b9981fb33d3/687474703a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f313539393636322f706e63686172742e706e67" | 182 | + s.screenshots = "https://camo.githubusercontent.com/e99c1bbab103c63efd561c4997a4bedb878bb2a2/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f313539393636322f706e63686172742e676966" |
| 183 | + | ||
| 184 | + # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 185 | + # | ||
| 186 | + # Licensing your code is important. See http://choosealicense.com for more info. | ||
| 187 | + # CocoaPods will detect a license file if there is a named LICENSE* | ||
| 188 | + # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. | ||
| 189 | + # | ||
| 190 | + | ||
| 191 | + s.license = { :type => "MIT", :file => "LICENSE" } | ||
| 8 | 192 | ||
| 9 | - s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
| 10 | 193 | ||
| 11 | - s.author = { "Kevin" => "kevinchou.c@gmail.com" } | 194 | + # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # |
| 195 | + # | ||
| 196 | + # Specify the authors of the library, with email addresses. Email addresses | ||
| 197 | + # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also | ||
| 198 | + # accepts just a name if you'd rather not provide an email address. | ||
| 199 | + # | ||
| 200 | + # Specify a social_media_url where others can refer to, for example a twitter | ||
| 201 | + # profile URL. | ||
| 202 | + # | ||
| 12 | 203 | ||
| 13 | - s.platform = :ios, '6.0' | 204 | + s.author = { "kevinzhow" => "kevinchou.c@gmail.com" } |
| 14 | - s.source = { :git => "https://github.com/moflo/PNChart.git" } | 205 | + # Or just: s.author = "kevinzhow" |
| 206 | + # s.authors = { "kevinzhow" => "kevinchou.c@gmail.com" } | ||
| 207 | + # s.social_media_url = "http://twitter.com/kevinzhow" | ||
| 15 | 208 | ||
| 16 | - s.ios.dependency 'UICountingLabel', '~> 1.0.0' | 209 | + # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # |
| 210 | + # | ||
| 211 | + # If this Pod runs only on iOS or OS X, then specify the platform and | ||
| 212 | + # the deployment target. You can optionally include the target after the platform. | ||
| 213 | + # | ||
| 214 | + | ||
| 215 | + s.platform = :ios, "6.0" | ||
| 216 | + | ||
| 217 | + # When using multiple platforms | ||
| 218 | + # s.ios.deployment_target = "5.0" | ||
| 219 | + # s.osx.deployment_target = "10.7" | ||
| 220 | + | ||
| 221 | + | ||
| 222 | + # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 223 | + # | ||
| 224 | + # Specify the location from where the source should be retrieved. | ||
| 225 | + # Supports git, hg, bzr, svn and HTTP. | ||
| 226 | + # | ||
| 227 | + | ||
| 228 | + s.source = { :git => "https://github.com/kevinzhow/PNChart.git", :tag => "0.5.5" } | ||
| 229 | + | ||
| 230 | + | ||
| 231 | + # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 232 | + # | ||
| 233 | + # CocoaPods is smart about how it includes source code. For source files | ||
| 234 | + # giving a folder will include any h, m, mm, c & cpp files. For header | ||
| 235 | + # files it will include any header in the folder. | ||
| 236 | + # Not including the public_header_files will make all headers public. | ||
| 237 | + # | ||
| 238 | + | ||
| 239 | + s.source_files = "PNChart", "PNChart/**/*.{h,m}" | ||
| 240 | + #s.exclude_files = "Classes/Exclude" | ||
| 241 | + | ||
| 242 | + s.public_header_files = "PNChart/**/*.h" | ||
| 243 | + | ||
| 244 | + | ||
| 245 | + # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 246 | + # | ||
| 247 | + # A list of resources included with the Pod. These are copied into the | ||
| 248 | + # target bundle with a build phase script. Anything else will be cleaned. | ||
| 249 | + # You can preserve files from being cleaned, please don't preserve | ||
| 250 | + # non-essential files like tests, examples and documentation. | ||
| 251 | + # | ||
| 252 | + | ||
| 253 | + # s.resource = "icon.png" | ||
| 254 | + # s.resources = "Resources/*.png" | ||
| 255 | + | ||
| 256 | + # s.preserve_paths = "FilesToSave", "MoreFilesToSave" | ||
| 257 | + | ||
| 258 | + | ||
| 259 | + # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 260 | + # | ||
| 261 | + # Link your library with frameworks, or libraries. Libraries do not include | ||
| 262 | + # the lib prefix of their name. | ||
| 263 | + # | ||
| 17 | 264 | ||
| 18 | - s.source_files = 'PNChart/**/*.{h,m}' | ||
| 19 | - s.public_header_files = 'PNChart/**/*.h' | ||
| 20 | s.frameworks = 'CoreGraphics', 'UIKit', 'Foundation', 'QuartzCore' | 265 | s.frameworks = 'CoreGraphics', 'UIKit', 'Foundation', 'QuartzCore' |
| 266 | + # s.frameworks = "SomeFramework", "AnotherFramework" | ||
| 267 | + | ||
| 268 | + # s.library = "iconv" | ||
| 269 | + # s.libraries = "iconv", "xml2" | ||
| 270 | + | ||
| 271 | + | ||
| 272 | + # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
| 273 | + # | ||
| 274 | + # If your library depends on compiler flags you can set them in the xcconfig hash | ||
| 275 | + # where they will only apply to your library. If you depend on other Podspecs | ||
| 276 | + # you can include multiple dependencies to ensure it works. | ||
| 277 | + | ||
| 21 | s.requires_arc = true | 278 | s.requires_arc = true |
| 279 | + | ||
| 280 | + # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } | ||
| 281 | + s.dependency 'UICountingLabel', '~> 1.0.0' | ||
| 282 | + | ||
| 22 | end | 283 | end |
-
Please register or login to post a comment