├── .gitignore ├── AdaptiveChartDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AdaptiveChartDemo ├── AdaptiveChart │ └── AdaptiveChart.swift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist └── ViewController.swift └── AdaptiveChartDemoTests ├── AdaptiveChartDemoTests.swift └── Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | -------------------------------------------------------------------------------- /AdaptiveChartDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 504F41351ACFCFF300FBB19A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41341ACFCFF300FBB19A /* AppDelegate.swift */; }; 11 | 504F41371ACFCFF300FBB19A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41361ACFCFF300FBB19A /* ViewController.swift */; }; 12 | 504F413A1ACFCFF300FBB19A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504F41381ACFCFF300FBB19A /* Main.storyboard */; }; 13 | 504F413C1ACFCFF300FBB19A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504F413B1ACFCFF300FBB19A /* Images.xcassets */; }; 14 | 504F413F1ACFCFF300FBB19A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 504F413D1ACFCFF300FBB19A /* LaunchScreen.xib */; }; 15 | 504F414B1ACFCFF300FBB19A /* AdaptiveChartDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F414A1ACFCFF300FBB19A /* AdaptiveChartDemoTests.swift */; }; 16 | 504F41551ACFD16800FBB19A /* AdaptiveChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41541ACFD16800FBB19A /* AdaptiveChart.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 504F41451ACFCFF300FBB19A /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 504F41271ACFCFF300FBB19A /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 504F412E1ACFCFF300FBB19A; 25 | remoteInfo = AdaptiveChartDemo; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 504F412F1ACFCFF300FBB19A /* AdaptiveChartDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdaptiveChartDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 504F41331ACFCFF300FBB19A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 504F41341ACFCFF300FBB19A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 504F41361ACFCFF300FBB19A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | 504F41391ACFCFF300FBB19A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 504F413B1ACFCFF300FBB19A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | 504F413E1ACFCFF300FBB19A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 37 | 504F41441ACFCFF300FBB19A /* AdaptiveChartDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdaptiveChartDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 504F41491ACFCFF300FBB19A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 504F414A1ACFCFF300FBB19A /* AdaptiveChartDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdaptiveChartDemoTests.swift; sourceTree = ""; }; 40 | 504F41541ACFD16800FBB19A /* AdaptiveChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AdaptiveChart.swift; path = AdaptiveChart/AdaptiveChart.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 504F412C1ACFCFF300FBB19A /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 504F41411ACFCFF300FBB19A /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 504F41261ACFCFF300FBB19A = { 62 | isa = PBXGroup; 63 | children = ( 64 | 504F41311ACFCFF300FBB19A /* AdaptiveChartDemo */, 65 | 504F41471ACFCFF300FBB19A /* AdaptiveChartDemoTests */, 66 | 504F41301ACFCFF300FBB19A /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 504F41301ACFCFF300FBB19A /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 504F412F1ACFCFF300FBB19A /* AdaptiveChartDemo.app */, 74 | 504F41441ACFCFF300FBB19A /* AdaptiveChartDemoTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 504F41311ACFCFF300FBB19A /* AdaptiveChartDemo */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 504F41341ACFCFF300FBB19A /* AppDelegate.swift */, 83 | 504F41361ACFCFF300FBB19A /* ViewController.swift */, 84 | 504F41541ACFD16800FBB19A /* AdaptiveChart.swift */, 85 | 504F41381ACFCFF300FBB19A /* Main.storyboard */, 86 | 504F413B1ACFCFF300FBB19A /* Images.xcassets */, 87 | 504F413D1ACFCFF300FBB19A /* LaunchScreen.xib */, 88 | 504F41321ACFCFF300FBB19A /* Supporting Files */, 89 | ); 90 | path = AdaptiveChartDemo; 91 | sourceTree = ""; 92 | }; 93 | 504F41321ACFCFF300FBB19A /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 504F41331ACFCFF300FBB19A /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 504F41471ACFCFF300FBB19A /* AdaptiveChartDemoTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 504F414A1ACFCFF300FBB19A /* AdaptiveChartDemoTests.swift */, 105 | 504F41481ACFCFF300FBB19A /* Supporting Files */, 106 | ); 107 | path = AdaptiveChartDemoTests; 108 | sourceTree = ""; 109 | }; 110 | 504F41481ACFCFF300FBB19A /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 504F41491ACFCFF300FBB19A /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 504F412E1ACFCFF300FBB19A /* AdaptiveChartDemo */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 504F414E1ACFCFF300FBB19A /* Build configuration list for PBXNativeTarget "AdaptiveChartDemo" */; 124 | buildPhases = ( 125 | 504F412B1ACFCFF300FBB19A /* Sources */, 126 | 504F412C1ACFCFF300FBB19A /* Frameworks */, 127 | 504F412D1ACFCFF300FBB19A /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = AdaptiveChartDemo; 134 | productName = AdaptiveChartDemo; 135 | productReference = 504F412F1ACFCFF300FBB19A /* AdaptiveChartDemo.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 504F41431ACFCFF300FBB19A /* AdaptiveChartDemoTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 504F41511ACFCFF300FBB19A /* Build configuration list for PBXNativeTarget "AdaptiveChartDemoTests" */; 141 | buildPhases = ( 142 | 504F41401ACFCFF300FBB19A /* Sources */, 143 | 504F41411ACFCFF300FBB19A /* Frameworks */, 144 | 504F41421ACFCFF300FBB19A /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 504F41461ACFCFF300FBB19A /* PBXTargetDependency */, 150 | ); 151 | name = AdaptiveChartDemoTests; 152 | productName = AdaptiveChartDemoTests; 153 | productReference = 504F41441ACFCFF300FBB19A /* AdaptiveChartDemoTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 504F41271ACFCFF300FBB19A /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0630; 163 | ORGANIZATIONNAME = nixWork; 164 | TargetAttributes = { 165 | 504F412E1ACFCFF300FBB19A = { 166 | CreatedOnToolsVersion = 6.3; 167 | }; 168 | 504F41431ACFCFF300FBB19A = { 169 | CreatedOnToolsVersion = 6.3; 170 | TestTargetID = 504F412E1ACFCFF300FBB19A; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 504F412A1ACFCFF300FBB19A /* Build configuration list for PBXProject "AdaptiveChartDemo" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 504F41261ACFCFF300FBB19A; 183 | productRefGroup = 504F41301ACFCFF300FBB19A /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 504F412E1ACFCFF300FBB19A /* AdaptiveChartDemo */, 188 | 504F41431ACFCFF300FBB19A /* AdaptiveChartDemoTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 504F412D1ACFCFF300FBB19A /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 504F413A1ACFCFF300FBB19A /* Main.storyboard in Resources */, 199 | 504F413F1ACFCFF300FBB19A /* LaunchScreen.xib in Resources */, 200 | 504F413C1ACFCFF300FBB19A /* Images.xcassets in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 504F41421ACFCFF300FBB19A /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 504F412B1ACFCFF300FBB19A /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 504F41371ACFCFF300FBB19A /* ViewController.swift in Sources */, 219 | 504F41351ACFCFF300FBB19A /* AppDelegate.swift in Sources */, 220 | 504F41551ACFD16800FBB19A /* AdaptiveChart.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 504F41401ACFCFF300FBB19A /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 504F414B1ACFCFF300FBB19A /* AdaptiveChartDemoTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 504F41461ACFCFF300FBB19A /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 504F412E1ACFCFF300FBB19A /* AdaptiveChartDemo */; 238 | targetProxy = 504F41451ACFCFF300FBB19A /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 504F41381ACFCFF300FBB19A /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 504F41391ACFCFF300FBB19A /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | 504F413D1ACFCFF300FBB19A /* LaunchScreen.xib */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | 504F413E1ACFCFF300FBB19A /* Base */, 255 | ); 256 | name = LaunchScreen.xib; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXVariantGroup section */ 260 | 261 | /* Begin XCBuildConfiguration section */ 262 | 504F414C1ACFCFF300FBB19A /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BOOL_CONVERSION = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | GCC_C_LANGUAGE_STANDARD = gnu99; 284 | GCC_DYNAMIC_NO_PIC = NO; 285 | GCC_NO_COMMON_BLOCKS = YES; 286 | GCC_OPTIMIZATION_LEVEL = 0; 287 | GCC_PREPROCESSOR_DEFINITIONS = ( 288 | "DEBUG=1", 289 | "$(inherited)", 290 | ); 291 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 299 | MTL_ENABLE_DEBUG_INFO = YES; 300 | ONLY_ACTIVE_ARCH = YES; 301 | SDKROOT = iphoneos; 302 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | }; 305 | name = Debug; 306 | }; 307 | 504F414D1ACFCFF300FBB19A /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_UNREACHABLE_CODE = YES; 323 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 324 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 325 | COPY_PHASE_STRIP = NO; 326 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 327 | ENABLE_NS_ASSERTIONS = NO; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu99; 330 | GCC_NO_COMMON_BLOCKS = YES; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | SDKROOT = iphoneos; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | VALIDATE_PRODUCT = YES; 342 | }; 343 | name = Release; 344 | }; 345 | 504F414F1ACFCFF300FBB19A /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | INFOPLIST_FILE = AdaptiveChartDemo/Info.plist; 350 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 351 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 352 | PRODUCT_NAME = "$(TARGET_NAME)"; 353 | }; 354 | name = Debug; 355 | }; 356 | 504F41501ACFCFF300FBB19A /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | INFOPLIST_FILE = AdaptiveChartDemo/Info.plist; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 362 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | }; 365 | name = Release; 366 | }; 367 | 504F41521ACFCFF300FBB19A /* Debug */ = { 368 | isa = XCBuildConfiguration; 369 | buildSettings = { 370 | BUNDLE_LOADER = "$(TEST_HOST)"; 371 | FRAMEWORK_SEARCH_PATHS = ( 372 | "$(SDKROOT)/Developer/Library/Frameworks", 373 | "$(inherited)", 374 | ); 375 | GCC_PREPROCESSOR_DEFINITIONS = ( 376 | "DEBUG=1", 377 | "$(inherited)", 378 | ); 379 | INFOPLIST_FILE = AdaptiveChartDemoTests/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdaptiveChartDemo.app/AdaptiveChartDemo"; 383 | }; 384 | name = Debug; 385 | }; 386 | 504F41531ACFCFF300FBB19A /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | BUNDLE_LOADER = "$(TEST_HOST)"; 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(SDKROOT)/Developer/Library/Frameworks", 392 | "$(inherited)", 393 | ); 394 | INFOPLIST_FILE = AdaptiveChartDemoTests/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdaptiveChartDemo.app/AdaptiveChartDemo"; 398 | }; 399 | name = Release; 400 | }; 401 | /* End XCBuildConfiguration section */ 402 | 403 | /* Begin XCConfigurationList section */ 404 | 504F412A1ACFCFF300FBB19A /* Build configuration list for PBXProject "AdaptiveChartDemo" */ = { 405 | isa = XCConfigurationList; 406 | buildConfigurations = ( 407 | 504F414C1ACFCFF300FBB19A /* Debug */, 408 | 504F414D1ACFCFF300FBB19A /* Release */, 409 | ); 410 | defaultConfigurationIsVisible = 0; 411 | defaultConfigurationName = Release; 412 | }; 413 | 504F414E1ACFCFF300FBB19A /* Build configuration list for PBXNativeTarget "AdaptiveChartDemo" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | 504F414F1ACFCFF300FBB19A /* Debug */, 417 | 504F41501ACFCFF300FBB19A /* Release */, 418 | ); 419 | defaultConfigurationIsVisible = 0; 420 | defaultConfigurationName = Release; 421 | }; 422 | 504F41511ACFCFF300FBB19A /* Build configuration list for PBXNativeTarget "AdaptiveChartDemoTests" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | 504F41521ACFCFF300FBB19A /* Debug */, 426 | 504F41531ACFCFF300FBB19A /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | /* End XCConfigurationList section */ 432 | }; 433 | rootObject = 504F41271ACFCFF300FBB19A /* Project object */; 434 | } 435 | -------------------------------------------------------------------------------- /AdaptiveChartDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/AdaptiveChart/AdaptiveChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AdaptiveChart.swift 3 | // AdaptiveChartDemo 4 | // 5 | // Created by NIX on 15/4/4. 6 | // Copyright (c) 2015年 nixWork. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class AdaptiveChart { 12 | 13 | private var size: CGSize 14 | private var edgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) 15 | private var graphColor = UIColor.greenColor() 16 | private var shadowColor = UIColor.greenColor().colorWithAlphaComponent(0.95) 17 | private var shadowOffset = CGSizeMake(0, 0) 18 | private var shadowBlurRadius: CGFloat = 5.0 19 | 20 | private var textFont = UIFont.systemFontOfSize(12) 21 | private var textColor = UIColor.redColor() 22 | 23 | private var barWidthPercentage: CGFloat = 0.618 24 | 25 | private var showNumber: Bool = false 26 | private var numberFont = UIFont.systemFontOfSize(8) 27 | private var numberColor = UIColor.greenColor() 28 | 29 | public enum NumberType { 30 | case Int 31 | case Double 32 | } 33 | private var numberType: NumberType = .Double 34 | 35 | 36 | private var data: [(String, Double)]? 37 | 38 | public init(size: CGSize) { 39 | self.size = size 40 | } 41 | 42 | public func setEdgeInsets(edgeInsets: UIEdgeInsets) -> AdaptiveChart { 43 | self.edgeInsets = edgeInsets 44 | return self 45 | } 46 | 47 | public func setGraphColor(graphColor: UIColor) -> AdaptiveChart { 48 | self.graphColor = graphColor 49 | self.shadowColor = graphColor.colorWithAlphaComponent(0.95) 50 | return self 51 | } 52 | 53 | public func setShadowColor(shadowColor: UIColor) -> AdaptiveChart { 54 | self.shadowColor = shadowColor 55 | return self 56 | } 57 | 58 | public func setShadowOffset(shadowOffset: CGSize) -> AdaptiveChart { 59 | self.shadowOffset = shadowOffset 60 | return self 61 | } 62 | 63 | public func setShadowBlurRadius(shadowBlurRadius: CGFloat) -> AdaptiveChart { 64 | self.shadowBlurRadius = shadowBlurRadius 65 | return self 66 | } 67 | 68 | public func setTextFont(textFont: UIFont) -> AdaptiveChart { 69 | self.textFont = textFont 70 | return self 71 | } 72 | 73 | public func setTextColor(textColor: UIColor) -> AdaptiveChart { 74 | self.textColor = textColor 75 | return self 76 | } 77 | 78 | public func setBarWidthPercentage(barWidthPercentage: CGFloat) -> AdaptiveChart { 79 | if barWidthPercentage > 1 { 80 | self.barWidthPercentage = 1 81 | } else if barWidthPercentage < 0 { 82 | self.barWidthPercentage = 0 83 | } else { 84 | self.barWidthPercentage = barWidthPercentage 85 | } 86 | return self 87 | } 88 | 89 | public func setShowNumber(showNumber: Bool) -> AdaptiveChart { 90 | self.showNumber = showNumber 91 | return self 92 | } 93 | 94 | public func setNumberFont(numberFont: UIFont) -> AdaptiveChart { 95 | self.numberFont = numberFont 96 | return self 97 | } 98 | 99 | public func setNumberColor(numberColor: UIColor) -> AdaptiveChart { 100 | self.numberColor = numberColor 101 | return self 102 | } 103 | 104 | public func setNumberType(numberType: NumberType) -> AdaptiveChart { 105 | self.numberType = numberType 106 | return self 107 | } 108 | 109 | public func setData(data: [(String, Double)]) -> AdaptiveChart { 110 | self.data = data 111 | return self 112 | } 113 | 114 | public enum ChartType { 115 | case Bar 116 | case Line 117 | } 118 | 119 | 120 | 121 | private struct ChartParams { 122 | var barTopMargin: CGFloat 123 | var barLeftMargin: CGFloat 124 | var barRightMargin: CGFloat 125 | var barBottomMargin: CGFloat 126 | var minBarRightMargin: CGFloat 127 | 128 | var maxNameWidth: CGFloat 129 | var maxNameHeight: CGFloat 130 | 131 | var rotateAngle: CGFloat 132 | 133 | var nameWidths = [CGFloat]() 134 | var maxValue: Double 135 | } 136 | 137 | private func compute() -> ChartParams? { 138 | if let data = data { 139 | 140 | let barTopMargin: CGFloat 141 | if (showNumber) { 142 | barTopMargin = edgeInsets.top + ceil(numberFont.lineHeight * 1.0) 143 | } else { 144 | barTopMargin = edgeInsets.top 145 | } 146 | 147 | let barLeftMargin = edgeInsets.left 148 | let minBarRightMargin = edgeInsets.right 149 | 150 | // 找出 name 中最长的,用于计算 barBottomMargin 151 | // 以及所有的 nameWidths 152 | 153 | let attributes = [NSFontAttributeName: textFont] 154 | 155 | var nameWidths = [CGFloat]() 156 | var maxValue: Double = 0 157 | var maxNameWidth: CGFloat = 0 158 | var maxNameHeight: CGFloat = 0 159 | 160 | for (name, value) in data { 161 | if value > maxValue { 162 | maxValue = value 163 | } 164 | 165 | let nameRect = name.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: 20), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: attributes, context: nil) 166 | println("name: \(name), nameRect, \(nameRect)") 167 | 168 | let nameRectWidth = nameRect.width 169 | 170 | nameWidths.append(nameRectWidth) 171 | 172 | if nameRectWidth > maxNameWidth { 173 | maxNameWidth = nameRectWidth 174 | } 175 | 176 | if nameRect.height > maxNameHeight { 177 | maxNameHeight = nameRect.height 178 | } 179 | } 180 | 181 | // Text 的旋转角度 182 | 183 | let rotateAngle = CGFloat(M_PI * 0.2) 184 | let ratio = cos(rotateAngle) 185 | 186 | // 因为方程复杂,所以使用牛顿迭代法,逼近最佳的 barWidth 187 | 188 | var currentTryRightMargin: CGFloat = 1 189 | var nextTryRightMargin: CGFloat = 0 190 | 191 | while true { 192 | 193 | var currentBarWidth = (size.width - barLeftMargin - currentTryRightMargin) / CGFloat(nameWidths.count) 194 | 195 | func nMax() -> CGFloat { 196 | var _max: CGFloat = 0 197 | for i in 0.. _max { 200 | _max = newValue 201 | } 202 | } 203 | 204 | return _max 205 | } 206 | 207 | let fN = max(nMax() - currentBarWidth * 0.5, minBarRightMargin) - currentTryRightMargin 208 | let fpN = 1 / CGFloat(nameWidths.count) * 0.5 - 1 209 | 210 | nextTryRightMargin = currentTryRightMargin - fN/fpN 211 | 212 | if abs(nextTryRightMargin - currentTryRightMargin) < 0.01 { 213 | break 214 | } 215 | 216 | currentTryRightMargin = nextTryRightMargin 217 | } 218 | 219 | var barRightMargin = currentTryRightMargin 220 | var barBottomMargin = maxNameWidth * sin(rotateAngle) + maxNameHeight * cos(rotateAngle) + edgeInsets.bottom 221 | 222 | return ChartParams(barTopMargin: barTopMargin, barLeftMargin: barLeftMargin, barRightMargin: barRightMargin, barBottomMargin: barBottomMargin, minBarRightMargin: minBarRightMargin, maxNameWidth: maxNameWidth, maxNameHeight: maxNameHeight, rotateAngle: rotateAngle, nameWidths: nameWidths, maxValue: maxValue) 223 | } 224 | 225 | return nil 226 | 227 | } 228 | 229 | public func imageWithChartType(chartType: ChartType) -> UIImage { 230 | 231 | if let data = data, let chartParams = compute() { 232 | 233 | var chartParams = chartParams 234 | 235 | let scale = UIScreen.mainScreen().scale 236 | UIGraphicsBeginImageContextWithOptions(size, false, scale) 237 | 238 | let imageContext = UIGraphicsGetCurrentContext() 239 | 240 | var barFullWidth = (size.width - chartParams.barLeftMargin - chartParams.barRightMargin) / CGFloat(data.count) 241 | 242 | // 如果 text 不需要倾斜,那就重新计算边界和 barFullWidth 243 | if chartParams.maxNameWidth <= barFullWidth { 244 | chartParams.barRightMargin = chartParams.minBarRightMargin 245 | chartParams.barBottomMargin = chartParams.maxNameHeight * cos(chartParams.rotateAngle) + edgeInsets.bottom 246 | 247 | barFullWidth = (size.width - chartParams.barLeftMargin - chartParams.barRightMargin) / CGFloat(data.count) 248 | } 249 | 250 | let barWidth = barWidthPercentage * barFullWidth 251 | 252 | let barFullHeight = size.height - (chartParams.barTopMargin + chartParams.barBottomMargin) 253 | 254 | if chartType == .Bar { 255 | for (index, (name, value)) in enumerate(data) { 256 | 257 | let centerX = (CGFloat(index) + 0.5) * barFullWidth + chartParams.barLeftMargin 258 | 259 | let topY = barFullHeight * CGFloat(1.0 - value / chartParams.maxValue) + chartParams.barTopMargin 260 | 261 | // bars 262 | 263 | CGContextSaveGState(imageContext) 264 | 265 | // shadow 266 | 267 | CGContextSetShadowWithColor(imageContext, shadowOffset, shadowBlurRadius, shadowColor.CGColor) 268 | 269 | let x = centerX - barWidth * 0.5 270 | let y = chartParams.barTopMargin + barFullHeight 271 | let width = barWidth 272 | let height = y - topY 273 | 274 | let bar = UIBezierPath(roundedRect: CGRect(x: x, y: topY, width: width, height: height), cornerRadius: barWidth * 0.1) 275 | 276 | graphColor.setFill() 277 | 278 | bar.fill() 279 | 280 | CGContextRestoreGState(imageContext) 281 | } 282 | 283 | } else if chartType == .Line { 284 | 285 | let baseLine = UIBezierPath() 286 | baseLine.lineWidth = 1.0 / scale 287 | 288 | let baseLineY = size.height - chartParams.barBottomMargin 289 | baseLine.moveToPoint(CGPoint(x: chartParams.barLeftMargin, y: baseLineY)) 290 | baseLine.addLineToPoint(CGPoint(x: size.width - chartParams.barRightMargin, y: baseLineY)) 291 | 292 | graphColor.colorWithAlphaComponent(0.618).setStroke() 293 | baseLine.stroke() 294 | 295 | let line = UIBezierPath() 296 | 297 | CGContextSaveGState(imageContext) 298 | 299 | for (index, (name, value)) in enumerate(data) { 300 | 301 | let centerX = (CGFloat(index) + 0.5) * barFullWidth + chartParams.barLeftMargin 302 | 303 | let topY = barFullHeight * CGFloat(1.0 - value / chartParams.maxValue) + chartParams.barTopMargin 304 | 305 | let point = CGPoint(x: centerX, y: topY) 306 | if index == 0 { 307 | line.moveToPoint(point) 308 | } else { 309 | line.addLineToPoint(point) 310 | } 311 | } 312 | 313 | graphColor.colorWithAlphaComponent(0.618).setStroke() 314 | 315 | line.stroke() 316 | 317 | CGContextRestoreGState(imageContext) 318 | 319 | // dots 320 | CGContextSaveGState(imageContext) 321 | 322 | // shadow 323 | 324 | CGContextSetShadowWithColor(imageContext, shadowOffset, shadowBlurRadius, shadowColor.CGColor) 325 | 326 | for (index, (name, value)) in enumerate(data) { 327 | 328 | let centerX = (CGFloat(index) + 0.5) * barFullWidth + chartParams.barLeftMargin 329 | 330 | let topY = barFullHeight * CGFloat(1.0 - value / chartParams.maxValue) + chartParams.barTopMargin 331 | 332 | let point = CGPoint(x: centerX, y: topY) 333 | let dot = UIBezierPath(arcCenter: point, radius: barWidth * 0.15, startAngle: 0, endAngle: CGFloat(M_PI * 2), clockwise: true) 334 | 335 | graphColor.setFill() 336 | 337 | dot.fill() 338 | } 339 | 340 | CGContextRestoreGState(imageContext) 341 | } 342 | 343 | for (index, (name, value)) in enumerate(data) { 344 | 345 | let centerX = (CGFloat(index) + 0.5) * barFullWidth + chartParams.barLeftMargin 346 | 347 | let topY = barFullHeight * CGFloat(1.0 - value / chartParams.maxValue) + chartParams.barTopMargin 348 | 349 | // Numbers 350 | if showNumber { 351 | let numberAttributes = [ 352 | NSFontAttributeName: numberFont, 353 | NSForegroundColorAttributeName: numberColor 354 | ] 355 | 356 | let number: String 357 | 358 | if numberType == .Int { 359 | number = NSString(format: "%.0f", value) as String 360 | } else { 361 | number = "\(value)" 362 | } 363 | 364 | let numberRect = number.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: 20), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: numberAttributes, context: nil) 365 | 366 | let realNumberRect = CGRect(x: centerX - numberRect.width * 0.5, y: topY - (numberRect.height * 1.3), width: numberRect.width, height: numberRect.height) 367 | number.drawInRect(realNumberRect, withAttributes: numberAttributes) 368 | } 369 | 370 | 371 | // Text 372 | let string = name 373 | 374 | let nameAttributes = [ 375 | NSFontAttributeName: textFont, 376 | NSForegroundColorAttributeName: textColor 377 | ] 378 | 379 | // 需要倾斜 380 | if chartParams.maxNameWidth > barFullWidth { 381 | CGContextSaveGState(imageContext) 382 | 383 | CGContextTranslateCTM(imageContext, centerX, chartParams.barTopMargin + barFullHeight) 384 | CGContextRotateCTM(imageContext, chartParams.rotateAngle) 385 | 386 | let stringRect = CGRect(x: 3, y: 3, width: 300, height: chartParams.maxNameHeight) 387 | string.drawInRect(stringRect, withAttributes: nameAttributes) 388 | 389 | CGContextRestoreGState(imageContext) 390 | 391 | } else { 392 | let width = chartParams.nameWidths[index] 393 | let stringRect = CGRect(x: centerX - width * 0.5, y: chartParams.barTopMargin + barFullHeight + 5, width: width+5, height: chartParams.maxNameHeight) 394 | string.drawInRect(stringRect, withAttributes: nameAttributes) 395 | } 396 | 397 | } 398 | 399 | // image 400 | var cgImage:CGImageRef = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext()); 401 | UIGraphicsEndImageContext(); 402 | 403 | let image = UIImage(CGImage: cgImage, scale: scale, orientation: .Up) 404 | 405 | return image! 406 | 407 | } else { 408 | return UIImage() 409 | } 410 | } 411 | } 412 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AdaptiveChartDemo 4 | // 5 | // Created by NIX on 15/4/4. 6 | // Copyright (c) 2015年 nixWork. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /AdaptiveChartDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.nixWork.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | UISupportedInterfaceOrientations~ipad 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationPortraitUpsideDown 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /AdaptiveChartDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // AdaptiveChartDemo 4 | // 5 | // Created by NIX on 15/4/4. 6 | // Copyright (c) 2015年 nixWork. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var appleImageView: UIImageView! 14 | 15 | @IBOutlet weak var chinaImageView: UIImageView! 16 | 17 | @IBOutlet weak var worldImageView: UIImageView! 18 | 19 | @IBOutlet weak var internetImageView: UIImageView! 20 | 21 | 22 | override func viewDidLayoutSubviews() { 23 | super.viewDidLayoutSubviews() 24 | 25 | appleImageView.image = AdaptiveChart(size: appleImageView.bounds.size) 26 | .setData([ 27 | ("Mac", 50), 28 | ("iPhone", 400), 29 | ("WATCH", 100), 30 | ]) 31 | .setTextFont(UIFont.systemFontOfSize(9)) 32 | .imageWithChartType(.Bar) 33 | 34 | 35 | chinaImageView.image = AdaptiveChart(size: chinaImageView.bounds.size) 36 | .setData([ 37 | ("1960", 174), 38 | ("1970", 208), 39 | ("1980", 317), 40 | ("1990", 665), 41 | ("2000", 1614), 42 | ("2010", 4127), 43 | ]) 44 | .setGraphColor(UIColor.redColor()) 45 | .setTextColor(UIColor.whiteColor()) 46 | .setTextFont(UIFont.systemFontOfSize(10)) 47 | .setShowNumber(true) 48 | .setNumberType(.Int) 49 | .setNumberColor(UIColor.greenColor()) 50 | .imageWithChartType(.Line) 51 | 52 | 53 | worldImageView.image = AdaptiveChart(size: worldImageView.bounds.size) 54 | .setData([ 55 | ("1960", 174), 56 | ("1970", 208), 57 | ("1980", 317), 58 | ("1990", 665), 59 | ("2000年有什么?", 1614), 60 | ("2010", 4127), 61 | ]) 62 | .setGraphColor(UIColor.redColor()) 63 | .setTextColor(UIColor.whiteColor()) 64 | .setTextFont(UIFont.systemFontOfSize(10)) 65 | .setShowNumber(true) 66 | .setNumberType(.Int) 67 | .setNumberColor(UIColor.greenColor()) 68 | .imageWithChartType(.Line) 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /AdaptiveChartDemoTests/AdaptiveChartDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AdaptiveChartDemoTests.swift 3 | // AdaptiveChartDemoTests 4 | // 5 | // Created by NIX on 15/4/4. 6 | // Copyright (c) 2015年 nixWork. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class AdaptiveChartDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /AdaptiveChartDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.nixWork.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | --------------------------------------------------------------------------------