├── .DS_Store ├── .gitignore ├── DynamicGraphView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Basti.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Basti.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── DynamicGraphView.xcscheme │ └── xcschememanagement.plist ├── DynamicGraphView ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── DynamicGraphView-Info.plist ├── DynamicGraphView-Prefix.pch ├── GraphView.h ├── GraphView.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ ├── InfoPlist.strings │ └── ViewController.xib ├── main.m ├── orangeButton.png ├── orangeButton@2x.png ├── orangeButtonHighlight.png └── orangeButtonHighlight@2x.png ├── DynamicGraphViewTests ├── DynamicGraphViewTests-Info.plist ├── DynamicGraphViewTests.h ├── DynamicGraphViewTests.m └── en.lproj │ └── InfoPlist.strings ├── LICENSE.md └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode files # 2 | ###################### 3 | DynamicGraphView.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/* 4 | DynamicGraphView.xcodeproj/xcuserdata/*.xcuserdatad/* 5 | DynamicGraphView.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/UserInterfaceState.xcuserstate 6 | DynamicGraphView.xcodeproj/project.xcworkspace/xcuserdata/* 7 | DynamicGraphView.xcodeproj/xcuserdata/* 8 | DynamicGraphView.xcodeproj/project.xcworkspace/xcshareddata/DynamicGraphView.xccheckout 9 | *.xccheckout 10 | 11 | # OSX files # 12 | ###################### 13 | .DS_Store 14 | .DS_Store? 15 | ._* 16 | .Spotlight-V100 17 | .Trashes 18 | Icon? 19 | ehthumbs.db 20 | Thumbs.db 21 | 22 | -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 40E6D20717635B0500C39563 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D20617635B0500C39563 /* UIKit.framework */; }; 11 | 40E6D20917635B0500C39563 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D20817635B0500C39563 /* Foundation.framework */; }; 12 | 40E6D20B17635B0500C39563 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D20A17635B0500C39563 /* CoreGraphics.framework */; }; 13 | 40E6D21117635B0600C39563 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D20F17635B0600C39563 /* InfoPlist.strings */; }; 14 | 40E6D21317635B0600C39563 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E6D21217635B0600C39563 /* main.m */; }; 15 | 40E6D21717635B0600C39563 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E6D21617635B0600C39563 /* AppDelegate.m */; }; 16 | 40E6D21917635B0600C39563 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D21817635B0600C39563 /* Default.png */; }; 17 | 40E6D21B17635B0600C39563 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D21A17635B0600C39563 /* Default@2x.png */; }; 18 | 40E6D21D17635B0600C39563 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D21C17635B0600C39563 /* Default-568h@2x.png */; }; 19 | 40E6D22017635B0600C39563 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E6D21F17635B0600C39563 /* ViewController.m */; }; 20 | 40E6D22317635B0600C39563 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D22117635B0600C39563 /* ViewController.xib */; }; 21 | 40E6D22B17635B0700C39563 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D22A17635B0700C39563 /* SenTestingKit.framework */; }; 22 | 40E6D22C17635B0700C39563 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D20617635B0500C39563 /* UIKit.framework */; }; 23 | 40E6D22D17635B0700C39563 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40E6D20817635B0500C39563 /* Foundation.framework */; }; 24 | 40E6D23517635B0700C39563 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D23317635B0700C39563 /* InfoPlist.strings */; }; 25 | 40E6D23817635B0700C39563 /* DynamicGraphViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E6D23717635B0700C39563 /* DynamicGraphViewTests.m */; }; 26 | 40E6D24317635CCE00C39563 /* GraphView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40E6D24217635CCE00C39563 /* GraphView.m */; }; 27 | 40E6D2481763674500C39563 /* orangeButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D2441763674500C39563 /* orangeButton.png */; }; 28 | 40E6D2491763674500C39563 /* orangeButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D2451763674500C39563 /* orangeButton@2x.png */; }; 29 | 40E6D24A1763674500C39563 /* orangeButtonHighlight.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D2461763674500C39563 /* orangeButtonHighlight.png */; }; 30 | 40E6D24B1763674500C39563 /* orangeButtonHighlight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 40E6D2471763674500C39563 /* orangeButtonHighlight@2x.png */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 40E6D22E17635B0700C39563 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 40E6D1FB17635B0500C39563 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 40E6D20217635B0500C39563; 39 | remoteInfo = DynamicGraphView; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 40E6D20317635B0500C39563 /* DynamicGraphView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DynamicGraphView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 40E6D20617635B0500C39563 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 46 | 40E6D20817635B0500C39563 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 40E6D20A17635B0500C39563 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 48 | 40E6D20E17635B0500C39563 /* DynamicGraphView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DynamicGraphView-Info.plist"; sourceTree = ""; }; 49 | 40E6D21017635B0600C39563 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 50 | 40E6D21217635B0600C39563 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 40E6D21417635B0600C39563 /* DynamicGraphView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DynamicGraphView-Prefix.pch"; sourceTree = ""; }; 52 | 40E6D21517635B0600C39563 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | 40E6D21617635B0600C39563 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | 40E6D21817635B0600C39563 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 55 | 40E6D21A17635B0600C39563 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 56 | 40E6D21C17635B0600C39563 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 57 | 40E6D21E17635B0600C39563 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 58 | 40E6D21F17635B0600C39563 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 59 | 40E6D22217635B0600C39563 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 60 | 40E6D22917635B0700C39563 /* DynamicGraphViewTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DynamicGraphViewTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 40E6D22A17635B0700C39563 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 62 | 40E6D23217635B0700C39563 /* DynamicGraphViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DynamicGraphViewTests-Info.plist"; sourceTree = ""; }; 63 | 40E6D23417635B0700C39563 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 64 | 40E6D23617635B0700C39563 /* DynamicGraphViewTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicGraphViewTests.h; sourceTree = ""; }; 65 | 40E6D23717635B0700C39563 /* DynamicGraphViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicGraphViewTests.m; sourceTree = ""; }; 66 | 40E6D24117635CCE00C39563 /* GraphView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphView.h; sourceTree = ""; }; 67 | 40E6D24217635CCE00C39563 /* GraphView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GraphView.m; sourceTree = ""; }; 68 | 40E6D2441763674500C39563 /* orangeButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orangeButton.png; sourceTree = ""; }; 69 | 40E6D2451763674500C39563 /* orangeButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "orangeButton@2x.png"; sourceTree = ""; }; 70 | 40E6D2461763674500C39563 /* orangeButtonHighlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orangeButtonHighlight.png; sourceTree = ""; }; 71 | 40E6D2471763674500C39563 /* orangeButtonHighlight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "orangeButtonHighlight@2x.png"; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | 40E6D20017635B0500C39563 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 40E6D20717635B0500C39563 /* UIKit.framework in Frameworks */, 80 | 40E6D20917635B0500C39563 /* Foundation.framework in Frameworks */, 81 | 40E6D20B17635B0500C39563 /* CoreGraphics.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | 40E6D22517635B0700C39563 /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | 40E6D22B17635B0700C39563 /* SenTestingKit.framework in Frameworks */, 90 | 40E6D22C17635B0700C39563 /* UIKit.framework in Frameworks */, 91 | 40E6D22D17635B0700C39563 /* Foundation.framework in Frameworks */, 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | /* End PBXFrameworksBuildPhase section */ 96 | 97 | /* Begin PBXGroup section */ 98 | 40E6D1FA17635B0500C39563 = { 99 | isa = PBXGroup; 100 | children = ( 101 | 40E6D20C17635B0500C39563 /* DynamicGraphView */, 102 | 40E6D23017635B0700C39563 /* DynamicGraphViewTests */, 103 | 40E6D20517635B0500C39563 /* Frameworks */, 104 | 40E6D20417635B0500C39563 /* Products */, 105 | ); 106 | sourceTree = ""; 107 | }; 108 | 40E6D20417635B0500C39563 /* Products */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 40E6D20317635B0500C39563 /* DynamicGraphView.app */, 112 | 40E6D22917635B0700C39563 /* DynamicGraphViewTests.octest */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 40E6D20517635B0500C39563 /* Frameworks */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 40E6D20617635B0500C39563 /* UIKit.framework */, 121 | 40E6D20817635B0500C39563 /* Foundation.framework */, 122 | 40E6D20A17635B0500C39563 /* CoreGraphics.framework */, 123 | 40E6D22A17635B0700C39563 /* SenTestingKit.framework */, 124 | ); 125 | name = Frameworks; 126 | sourceTree = ""; 127 | }; 128 | 40E6D20C17635B0500C39563 /* DynamicGraphView */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 40E6D21517635B0600C39563 /* AppDelegate.h */, 132 | 40E6D21617635B0600C39563 /* AppDelegate.m */, 133 | 40E6D21E17635B0600C39563 /* ViewController.h */, 134 | 40E6D21F17635B0600C39563 /* ViewController.m */, 135 | 40E6D24117635CCE00C39563 /* GraphView.h */, 136 | 40E6D24217635CCE00C39563 /* GraphView.m */, 137 | 40E6D22117635B0600C39563 /* ViewController.xib */, 138 | 40E6D20D17635B0500C39563 /* Supporting Files */, 139 | ); 140 | path = DynamicGraphView; 141 | sourceTree = ""; 142 | }; 143 | 40E6D20D17635B0500C39563 /* Supporting Files */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 40E6D2441763674500C39563 /* orangeButton.png */, 147 | 40E6D2451763674500C39563 /* orangeButton@2x.png */, 148 | 40E6D2461763674500C39563 /* orangeButtonHighlight.png */, 149 | 40E6D2471763674500C39563 /* orangeButtonHighlight@2x.png */, 150 | 40E6D20E17635B0500C39563 /* DynamicGraphView-Info.plist */, 151 | 40E6D20F17635B0600C39563 /* InfoPlist.strings */, 152 | 40E6D21217635B0600C39563 /* main.m */, 153 | 40E6D21417635B0600C39563 /* DynamicGraphView-Prefix.pch */, 154 | 40E6D21817635B0600C39563 /* Default.png */, 155 | 40E6D21A17635B0600C39563 /* Default@2x.png */, 156 | 40E6D21C17635B0600C39563 /* Default-568h@2x.png */, 157 | ); 158 | name = "Supporting Files"; 159 | sourceTree = ""; 160 | }; 161 | 40E6D23017635B0700C39563 /* DynamicGraphViewTests */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 40E6D23617635B0700C39563 /* DynamicGraphViewTests.h */, 165 | 40E6D23717635B0700C39563 /* DynamicGraphViewTests.m */, 166 | 40E6D23117635B0700C39563 /* Supporting Files */, 167 | ); 168 | path = DynamicGraphViewTests; 169 | sourceTree = ""; 170 | }; 171 | 40E6D23117635B0700C39563 /* Supporting Files */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 40E6D23217635B0700C39563 /* DynamicGraphViewTests-Info.plist */, 175 | 40E6D23317635B0700C39563 /* InfoPlist.strings */, 176 | ); 177 | name = "Supporting Files"; 178 | sourceTree = ""; 179 | }; 180 | /* End PBXGroup section */ 181 | 182 | /* Begin PBXNativeTarget section */ 183 | 40E6D20217635B0500C39563 /* DynamicGraphView */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 40E6D23B17635B0700C39563 /* Build configuration list for PBXNativeTarget "DynamicGraphView" */; 186 | buildPhases = ( 187 | 40E6D1FF17635B0500C39563 /* Sources */, 188 | 40E6D20017635B0500C39563 /* Frameworks */, 189 | 40E6D20117635B0500C39563 /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | ); 195 | name = DynamicGraphView; 196 | productName = DynamicGraphView; 197 | productReference = 40E6D20317635B0500C39563 /* DynamicGraphView.app */; 198 | productType = "com.apple.product-type.application"; 199 | }; 200 | 40E6D22817635B0700C39563 /* DynamicGraphViewTests */ = { 201 | isa = PBXNativeTarget; 202 | buildConfigurationList = 40E6D23E17635B0700C39563 /* Build configuration list for PBXNativeTarget "DynamicGraphViewTests" */; 203 | buildPhases = ( 204 | 40E6D22417635B0700C39563 /* Sources */, 205 | 40E6D22517635B0700C39563 /* Frameworks */, 206 | 40E6D22617635B0700C39563 /* Resources */, 207 | 40E6D22717635B0700C39563 /* ShellScript */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | 40E6D22F17635B0700C39563 /* PBXTargetDependency */, 213 | ); 214 | name = DynamicGraphViewTests; 215 | productName = DynamicGraphViewTests; 216 | productReference = 40E6D22917635B0700C39563 /* DynamicGraphViewTests.octest */; 217 | productType = "com.apple.product-type.bundle"; 218 | }; 219 | /* End PBXNativeTarget section */ 220 | 221 | /* Begin PBXProject section */ 222 | 40E6D1FB17635B0500C39563 /* Project object */ = { 223 | isa = PBXProject; 224 | attributes = { 225 | LastUpgradeCheck = 0460; 226 | ORGANIZATIONNAME = "Bastian Kohlbauer"; 227 | }; 228 | buildConfigurationList = 40E6D1FE17635B0500C39563 /* Build configuration list for PBXProject "DynamicGraphView" */; 229 | compatibilityVersion = "Xcode 3.2"; 230 | developmentRegion = English; 231 | hasScannedForEncodings = 0; 232 | knownRegions = ( 233 | en, 234 | ); 235 | mainGroup = 40E6D1FA17635B0500C39563; 236 | productRefGroup = 40E6D20417635B0500C39563 /* Products */; 237 | projectDirPath = ""; 238 | projectRoot = ""; 239 | targets = ( 240 | 40E6D20217635B0500C39563 /* DynamicGraphView */, 241 | 40E6D22817635B0700C39563 /* DynamicGraphViewTests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | 40E6D20117635B0500C39563 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 40E6D21117635B0600C39563 /* InfoPlist.strings in Resources */, 252 | 40E6D21917635B0600C39563 /* Default.png in Resources */, 253 | 40E6D21B17635B0600C39563 /* Default@2x.png in Resources */, 254 | 40E6D21D17635B0600C39563 /* Default-568h@2x.png in Resources */, 255 | 40E6D22317635B0600C39563 /* ViewController.xib in Resources */, 256 | 40E6D2481763674500C39563 /* orangeButton.png in Resources */, 257 | 40E6D2491763674500C39563 /* orangeButton@2x.png in Resources */, 258 | 40E6D24A1763674500C39563 /* orangeButtonHighlight.png in Resources */, 259 | 40E6D24B1763674500C39563 /* orangeButtonHighlight@2x.png in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | 40E6D22617635B0700C39563 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 40E6D23517635B0700C39563 /* InfoPlist.strings in Resources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXShellScriptBuildPhase section */ 274 | 40E6D22717635B0700C39563 /* ShellScript */ = { 275 | isa = PBXShellScriptBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | inputPaths = ( 280 | ); 281 | outputPaths = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | shellPath = /bin/sh; 285 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 286 | }; 287 | /* End PBXShellScriptBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 40E6D1FF17635B0500C39563 /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 40E6D21317635B0600C39563 /* main.m in Sources */, 295 | 40E6D21717635B0600C39563 /* AppDelegate.m in Sources */, 296 | 40E6D22017635B0600C39563 /* ViewController.m in Sources */, 297 | 40E6D24317635CCE00C39563 /* GraphView.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 40E6D22417635B0700C39563 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 40E6D23817635B0700C39563 /* DynamicGraphViewTests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 40E6D22F17635B0700C39563 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 40E6D20217635B0500C39563 /* DynamicGraphView */; 315 | targetProxy = 40E6D22E17635B0700C39563 /* PBXContainerItemProxy */; 316 | }; 317 | /* End PBXTargetDependency section */ 318 | 319 | /* Begin PBXVariantGroup section */ 320 | 40E6D20F17635B0600C39563 /* InfoPlist.strings */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 40E6D21017635B0600C39563 /* en */, 324 | ); 325 | name = InfoPlist.strings; 326 | sourceTree = ""; 327 | }; 328 | 40E6D22117635B0600C39563 /* ViewController.xib */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | 40E6D22217635B0600C39563 /* en */, 332 | ); 333 | name = ViewController.xib; 334 | sourceTree = ""; 335 | }; 336 | 40E6D23317635B0700C39563 /* InfoPlist.strings */ = { 337 | isa = PBXVariantGroup; 338 | children = ( 339 | 40E6D23417635B0700C39563 /* en */, 340 | ); 341 | name = InfoPlist.strings; 342 | sourceTree = ""; 343 | }; 344 | /* End PBXVariantGroup section */ 345 | 346 | /* Begin XCBuildConfiguration section */ 347 | 40E6D23917635B0700C39563 /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ALWAYS_SEARCH_USER_PATHS = NO; 351 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 352 | CLANG_CXX_LIBRARY = "libc++"; 353 | CLANG_ENABLE_OBJC_ARC = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_OPTIMIZATION_LEVEL = 0; 364 | GCC_PREPROCESSOR_DEFINITIONS = ( 365 | "DEBUG=1", 366 | "$(inherited)", 367 | ); 368 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 369 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 371 | GCC_WARN_UNUSED_VARIABLE = YES; 372 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 373 | ONLY_ACTIVE_ARCH = YES; 374 | SDKROOT = iphoneos; 375 | }; 376 | name = Debug; 377 | }; 378 | 40E6D23A17635B0700C39563 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 383 | CLANG_CXX_LIBRARY = "libc++"; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_EMPTY_BODY = YES; 387 | CLANG_WARN_ENUM_CONVERSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = YES; 392 | GCC_C_LANGUAGE_STANDARD = gnu99; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 395 | GCC_WARN_UNUSED_VARIABLE = YES; 396 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 397 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 398 | SDKROOT = iphoneos; 399 | VALIDATE_PRODUCT = YES; 400 | }; 401 | name = Release; 402 | }; 403 | 40E6D23C17635B0700C39563 /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 407 | GCC_PREFIX_HEADER = "DynamicGraphView/DynamicGraphView-Prefix.pch"; 408 | INFOPLIST_FILE = "DynamicGraphView/DynamicGraphView-Info.plist"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | WRAPPER_EXTENSION = app; 411 | }; 412 | name = Debug; 413 | }; 414 | 40E6D23D17635B0700C39563 /* Release */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 418 | GCC_PREFIX_HEADER = "DynamicGraphView/DynamicGraphView-Prefix.pch"; 419 | INFOPLIST_FILE = "DynamicGraphView/DynamicGraphView-Info.plist"; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | WRAPPER_EXTENSION = app; 422 | }; 423 | name = Release; 424 | }; 425 | 40E6D23F17635B0700C39563 /* Debug */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DynamicGraphView.app/DynamicGraphView"; 429 | FRAMEWORK_SEARCH_PATHS = ( 430 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 431 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 432 | ); 433 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 434 | GCC_PREFIX_HEADER = "DynamicGraphView/DynamicGraphView-Prefix.pch"; 435 | INFOPLIST_FILE = "DynamicGraphViewTests/DynamicGraphViewTests-Info.plist"; 436 | PRODUCT_NAME = "$(TARGET_NAME)"; 437 | TEST_HOST = "$(BUNDLE_LOADER)"; 438 | WRAPPER_EXTENSION = octest; 439 | }; 440 | name = Debug; 441 | }; 442 | 40E6D24017635B0700C39563 /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DynamicGraphView.app/DynamicGraphView"; 446 | FRAMEWORK_SEARCH_PATHS = ( 447 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 448 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 449 | ); 450 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 451 | GCC_PREFIX_HEADER = "DynamicGraphView/DynamicGraphView-Prefix.pch"; 452 | INFOPLIST_FILE = "DynamicGraphViewTests/DynamicGraphViewTests-Info.plist"; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TEST_HOST = "$(BUNDLE_LOADER)"; 455 | WRAPPER_EXTENSION = octest; 456 | }; 457 | name = Release; 458 | }; 459 | /* End XCBuildConfiguration section */ 460 | 461 | /* Begin XCConfigurationList section */ 462 | 40E6D1FE17635B0500C39563 /* Build configuration list for PBXProject "DynamicGraphView" */ = { 463 | isa = XCConfigurationList; 464 | buildConfigurations = ( 465 | 40E6D23917635B0700C39563 /* Debug */, 466 | 40E6D23A17635B0700C39563 /* Release */, 467 | ); 468 | defaultConfigurationIsVisible = 0; 469 | defaultConfigurationName = Release; 470 | }; 471 | 40E6D23B17635B0700C39563 /* Build configuration list for PBXNativeTarget "DynamicGraphView" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | 40E6D23C17635B0700C39563 /* Debug */, 475 | 40E6D23D17635B0700C39563 /* Release */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | 40E6D23E17635B0700C39563 /* Build configuration list for PBXNativeTarget "DynamicGraphViewTests" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 40E6D23F17635B0700C39563 /* Debug */, 484 | 40E6D24017635B0700C39563 /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | /* End XCConfigurationList section */ 490 | }; 491 | rootObject = 40E6D1FB17635B0500C39563 /* Project object */; 492 | } 493 | -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/project.xcworkspace/xcuserdata/Basti.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView.xcodeproj/project.xcworkspace/xcuserdata/Basti.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/xcuserdata/Basti.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/xcuserdata/Basti.xcuserdatad/xcschemes/DynamicGraphView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /DynamicGraphView.xcodeproj/xcuserdata/Basti.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DynamicGraphView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 40E6D20217635B0500C39563 16 | 17 | primary 18 | 19 | 20 | 40E6D22817635B0700C39563 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DynamicGraphView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import 17 | 18 | @class ViewController; 19 | 20 | @interface AppDelegate : UIResponder 21 | 22 | @property (strong, nonatomic) UIWindow *window; 23 | 24 | @property (strong, nonatomic) ViewController *viewController; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DynamicGraphView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import "AppDelegate.h" 17 | 18 | #import "ViewController.h" 19 | 20 | @implementation AppDelegate 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 23 | { 24 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 25 | // Override point for customization after application launch. 26 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 27 | self.window.rootViewController = self.viewController; 28 | [self.window makeKeyAndVisible]; 29 | return YES; 30 | } 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application 33 | { 34 | // 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. 35 | // 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. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application 39 | { 40 | // 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. 41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 42 | } 43 | 44 | - (void)applicationWillEnterForeground:(UIApplication *)application 45 | { 46 | // 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. 47 | } 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application 50 | { 51 | // 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. 52 | } 53 | 54 | - (void)applicationWillTerminate:(UIApplication *)application 55 | { 56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /DynamicGraphView/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/Default-568h@2x.png -------------------------------------------------------------------------------- /DynamicGraphView/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/Default.png -------------------------------------------------------------------------------- /DynamicGraphView/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/Default@2x.png -------------------------------------------------------------------------------- /DynamicGraphView/DynamicGraphView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | Bastian-Kohlbauer.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /DynamicGraphView/DynamicGraphView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'DynamicGraphView' target in the 'DynamicGraphView' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /DynamicGraphView/GraphView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GraphView.h 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import 17 | 18 | @interface GraphView : UIView { 19 | 20 | NSMutableArray *pointArray; 21 | 22 | float dx; 23 | float dy; 24 | 25 | int spacing; 26 | 27 | BOOL fillGraph; 28 | 29 | UILabel *max; 30 | UILabel *zero; 31 | UILabel *min; 32 | 33 | int setZero; 34 | 35 | UIColor *strokeColor; 36 | UIColor *fillColor; 37 | 38 | UIColor *zeroLineStrokeColor; 39 | 40 | int lineWidth; 41 | 42 | int granularity; 43 | 44 | } 45 | 46 | // add point to the array dynamically 47 | -(void)setPoint:(float)point; 48 | 49 | // reset graph to all 0.0 values 50 | -(void)resetGraph; 51 | 52 | // set an array of alues to be displayed in a the graph 53 | -(void)setArray:(NSArray*)array ; 54 | 55 | // set the spacing from the max value in graph array to top of view. default = 10. 56 | -(void)setSpacing:(int)space; 57 | 58 | // set the view to fill below graph. default = YES 59 | -(void)setFill:(BOOL)fill; 60 | 61 | // set the color of the graph line. default = [UIColor redColor]. 62 | -(void)setStrokeColor:(UIColor*)color; 63 | 64 | // set the color of the zero line. default = [UIColor greenColor]. 65 | -(void)setZeroLineStrokeColor:(UIColor*)color; 66 | 67 | // set the filled space below graph. default = [UIColor orangeColor]. 68 | -(void)setFillColor:(UIColor*)color; 69 | 70 | // set the color of the graph line. default = 2. 71 | -(void)setLineWidth:(int)width; 72 | 73 | // set up the number of values diplayes in the graph along the x-axis 74 | -(void)setNumberOfPointsInGraph:(int)numberOfPoints; 75 | 76 | // set curved graph lines. default = YES; 77 | -(void)setCurvedLines:(BOOL)curved; 78 | 79 | // hides the axis labels 80 | -(void)hideAxis:(BOOL)yesOrNo; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /DynamicGraphView/GraphView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GraphView.m 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import "GraphView.h" 17 | 18 | @implementation GraphView 19 | 20 | 21 | - (instancetype)initWithFrame:(CGRect)frame 22 | { 23 | self = [super initWithFrame:frame]; 24 | if (self) { 25 | [self setupGraph]; 26 | } 27 | 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 32 | { 33 | self = [super initWithCoder:aDecoder]; 34 | if (self) { 35 | [self setupGraph]; 36 | } 37 | 38 | return self; 39 | } 40 | 41 | - (void)setupGraph 42 | { 43 | // Initialization code 44 | 45 | self.backgroundColor = [UIColor yellowColor]; 46 | 47 | fillGraph = YES; 48 | 49 | spacing = 10; 50 | 51 | strokeColor = [UIColor redColor]; 52 | 53 | fillColor = [UIColor orangeColor]; 54 | 55 | zeroLineStrokeColor = [UIColor greenColor]; 56 | 57 | lineWidth = 2; 58 | 59 | max = [[UILabel alloc] initWithFrame:CGRectMake(2, 2, 25, 16)]; 60 | [max setAdjustsFontSizeToFitWidth:YES]; 61 | [max setBackgroundColor:[UIColor clearColor]]; 62 | [max setTextColor:[UIColor blackColor]]; 63 | [max setText:@"10"]; 64 | [self addSubview:max]; 65 | 66 | zero = [[UILabel alloc] initWithFrame:CGRectMake(2, CGRectGetMidY(self.frame) - 7.5, 25, 16)]; 67 | [zero setAdjustsFontSizeToFitWidth:YES]; 68 | [zero setBackgroundColor:[UIColor clearColor]]; 69 | [zero setTextColor:[UIColor blackColor]]; 70 | [self addSubview:zero]; 71 | 72 | min = [[UILabel alloc] initWithFrame:CGRectMake(2, CGRectGetHeight(self.frame)-15, 25, 16)]; 73 | [min setAdjustsFontSizeToFitWidth:YES]; 74 | [min setBackgroundColor:[UIColor clearColor]]; 75 | [min setTextColor:[UIColor blackColor]]; 76 | [min setText:@"0"]; 77 | [self addSubview:min]; 78 | 79 | dx = 50; // number of points shown in graph 80 | dy = 100; // default value for dy 81 | 82 | pointArray = [[NSMutableArray alloc]init]; //stores the energy values 83 | for (int i = 0; i < dx; i++) { 84 | [pointArray addObject:@0.0f]; 85 | } 86 | } 87 | 88 | -(void)setPoint:(float)point { 89 | 90 | [pointArray insertObject:@(point) atIndex:0]; 91 | [pointArray removeObjectAtIndex:[pointArray count] - 1]; 92 | 93 | [self setNeedsDisplay]; 94 | } 95 | 96 | -(void)resetGraph { 97 | 98 | pointArray = [[NSMutableArray alloc]init]; //stores the energy values 99 | for (int i = 0; i < dx; i++) { 100 | [pointArray addObject:@0.0f]; 101 | } 102 | 103 | [self setNeedsDisplay]; 104 | 105 | } 106 | 107 | -(void)setArray:(NSArray*)array { 108 | 109 | pointArray = [[NSMutableArray alloc]initWithArray:array]; 110 | 111 | dx = [pointArray count]; 112 | 113 | [self setNeedsDisplay]; 114 | } 115 | 116 | -(void)setSpacing:(int)space { 117 | 118 | spacing = space; 119 | 120 | [self setNeedsDisplay]; 121 | } 122 | 123 | -(void)setFill:(BOOL)fill { 124 | 125 | fillGraph = fill; 126 | 127 | [self setNeedsDisplay]; 128 | } 129 | 130 | -(void)setStrokeColor:(UIColor*)color { 131 | 132 | strokeColor = color; 133 | 134 | [self setNeedsDisplay]; 135 | } 136 | 137 | -(void)setZeroLineStrokeColor:(UIColor*)color { 138 | 139 | zeroLineStrokeColor = color; 140 | 141 | [self setNeedsDisplay]; 142 | } 143 | 144 | -(void)setFillColor:(UIColor*)color { 145 | 146 | fillColor = color; 147 | 148 | [self setNeedsDisplay]; 149 | } 150 | 151 | -(void)setLineWidth:(int)width { 152 | 153 | lineWidth = width; 154 | 155 | [self setNeedsDisplay]; 156 | } 157 | 158 | -(void)setNumberOfPointsInGraph:(int)numberOfPoints { 159 | 160 | dx = numberOfPoints; 161 | 162 | if ([pointArray count] < dx) { 163 | 164 | int dCount = dx - [pointArray count]; 165 | 166 | for (int i = 0; i < dCount; i++) { 167 | [pointArray addObject:@(0.0f)]; 168 | } 169 | 170 | } 171 | 172 | if ([pointArray count] > dx) { 173 | 174 | int dCount = [pointArray count] - dx; 175 | 176 | for (int i = 0; i < dCount; i++) { 177 | [pointArray removeLastObject]; 178 | } 179 | 180 | } 181 | 182 | [self setNeedsDisplay]; 183 | 184 | } 185 | 186 | -(void)setCurvedLines:(BOOL)curved { 187 | 188 | //the granularity value sets "curviness" of the graph depending on amount wanted and precission of the graph 189 | 190 | if (curved == YES) { 191 | granularity = 20; 192 | }else{ 193 | granularity = 0; 194 | } 195 | } 196 | 197 | // here the graph is actually being drawn 198 | - (void)drawRect:(CGRect)rect { 199 | 200 | [self calculateHeight]; 201 | 202 | // draw null line in the middle 203 | if (setZero == 2) { 204 | 205 | [zeroLineStrokeColor setStroke]; 206 | 207 | UIBezierPath *zeroLine = [UIBezierPath bezierPath]; 208 | [zeroLine moveToPoint:CGPointMake(0, self.frame.size.height/2)]; 209 | [zeroLine addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height/2)]; 210 | zeroLine.lineWidth = lineWidth; // line width 211 | [zeroLine stroke]; 212 | } 213 | 214 | CGPoint leftBottom = CGPointMake(0, self.frame.size.height); 215 | CGPoint rightBottom = CGPointMake(self.frame.size.width, self.frame.size.height); 216 | 217 | NSMutableArray *points = [[self arrayOfPoints] mutableCopy]; 218 | 219 | // Add control points to make the math make sense 220 | [points insertObject:points[0] atIndex:0]; 221 | [points addObject:[points lastObject]]; 222 | 223 | UIBezierPath *lineGraph = [UIBezierPath bezierPath]; 224 | 225 | [lineGraph moveToPoint:[points[0] CGPointValue]]; 226 | 227 | for (NSUInteger index = 1; index < points.count - 2; index++) 228 | { 229 | 230 | CGPoint p0 = [(NSValue *)points[index - 1] CGPointValue]; 231 | CGPoint p1 = [(NSValue *)points[index] CGPointValue]; 232 | CGPoint p2 = [(NSValue *)points[index + 1] CGPointValue]; 233 | CGPoint p3 = [(NSValue *)points[index + 2] CGPointValue]; 234 | 235 | // now add n points starting at p1 + dx/dy up until p2 using Catmull-Rom splines 236 | for (int i = 1; i < granularity; i++) 237 | { 238 | float t = (float) i * (1.0f / (float) granularity); 239 | float tt = t * t; 240 | float ttt = tt * t; 241 | 242 | CGPoint pi; // intermediate point 243 | pi.x = 0.5 * (2*p1.x+(p2.x-p0.x)*t + (2*p0.x-5*p1.x+4*p2.x-p3.x)*tt + (3*p1.x-p0.x-3*p2.x+p3.x)*ttt); 244 | pi.y = 0.5 * (2*p1.y+(p2.y-p0.y)*t + (2*p0.y-5*p1.y+4*p2.y-p3.y)*tt + (3*p1.y-p0.y-3*p2.y+p3.y)*ttt); 245 | [lineGraph addLineToPoint:pi]; 246 | } 247 | 248 | // Now add p2 249 | [lineGraph addLineToPoint:p2]; 250 | } 251 | 252 | // finish by adding the last point 253 | [lineGraph addLineToPoint:[(NSValue *)points[(points.count - 1)] CGPointValue]]; 254 | 255 | [fillColor setFill]; 256 | [strokeColor setStroke]; 257 | 258 | if (fillGraph) { 259 | [lineGraph addLineToPoint:CGPointMake(leftBottom.x, leftBottom.y)]; 260 | [lineGraph addLineToPoint:CGPointMake(rightBottom.x, rightBottom.y)]; 261 | [lineGraph closePath]; 262 | [lineGraph fill]; // fill color (if closed) 263 | } 264 | 265 | lineGraph.lineCapStyle = kCGLineCapRound; 266 | lineGraph.lineJoinStyle = kCGLineJoinRound; 267 | lineGraph.flatness = 0.5; 268 | lineGraph.lineWidth = lineWidth; // line width 269 | [lineGraph stroke]; 270 | 271 | 272 | } 273 | 274 | - (NSArray*)arrayOfPoints { 275 | 276 | NSMutableArray *points = [NSMutableArray array]; 277 | 278 | int viewWidth = CGRectGetWidth(self.frame); 279 | int viewHeight = CGRectGetHeight(self.frame); 280 | 281 | for (int i = 0; i < [pointArray count]; i++) { 282 | 283 | 284 | float point1x = viewWidth - (viewWidth / dx) * i; // start graph x on the right hand side 285 | float point1y = (viewHeight - (viewHeight / dy) * [pointArray[i] floatValue]) / setZero; //start graph y on the bottom 286 | 287 | float point2x = viewWidth - (viewWidth / dx) * i - (viewWidth / dx); 288 | float point2y = point1y; 289 | 290 | if (i != [pointArray count]-1) { 291 | point2y = (viewHeight - (viewHeight / dy) * [pointArray[i+1] floatValue]) / setZero; 292 | } 293 | 294 | CGPoint p; 295 | 296 | if (i == 0) { 297 | p = CGPointMake(point1x, point1y); 298 | }else{ 299 | p = CGPointMake(point2x, point2y); 300 | } 301 | [points addObject:[NSValue valueWithCGPoint:p]]; 302 | 303 | NSLog(@"point: %@", NSStringFromCGPoint(p)); 304 | } 305 | 306 | return points; 307 | 308 | } 309 | 310 | // this is where the dynamic height of the graph is calculated 311 | -(void)calculateHeight { 312 | 313 | int minValue = [[pointArray valueForKeyPath:@"@min.self"] integerValue]; 314 | int maxValue = [[pointArray valueForKeyPath:@"@max.self"] integerValue]; 315 | 316 | dy = maxValue + abs(minValue) + spacing; 317 | 318 | // set maxValue and round the float 319 | [max setText:[NSString stringWithFormat:@"%i", (int)(dy + 0.0) ]]; 320 | 321 | 322 | // set graphView for values below 0 323 | if (minValue < 0) { 324 | setZero = 2; 325 | [zero setText:@"0"]; 326 | [min setText:[NSString stringWithFormat:@"-%i", (int)(dy + 0.0) ]]; 327 | }else{ 328 | setZero = 1; 329 | [zero setText:@""]; 330 | [min setText:[NSString stringWithFormat:@"0"]]; 331 | } 332 | } 333 | 334 | // hides the axis labels 335 | - (void)hideAxis:(BOOL)yesOrNo 336 | { 337 | [max setHidden:yesOrNo]; 338 | [min setHidden:yesOrNo]; 339 | [zero setHidden:yesOrNo]; 340 | } 341 | 342 | @end 343 | -------------------------------------------------------------------------------- /DynamicGraphView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import 17 | #import "GraphView.h" 18 | 19 | @interface ViewController : UIViewController { 20 | 21 | GraphView *graphView; 22 | 23 | UITextField *visiblePoints; 24 | } 25 | 26 | @property (strong, nonatomic) GraphView *graphView; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DynamicGraphView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | /* 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #import "ViewController.h" 17 | #import 18 | 19 | @interface ViewController () 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | @synthesize graphView = _graphView; 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | // Do any additional setup after loading the view, typically from a nib. 31 | 32 | 33 | // init graphView and set up options 34 | graphView = [[GraphView alloc]initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, 180)]; 35 | [graphView setBackgroundColor:[UIColor yellowColor]]; 36 | [graphView setSpacing:10]; 37 | [graphView setFill:YES]; 38 | [graphView setStrokeColor:[UIColor redColor]]; 39 | [graphView setZeroLineStrokeColor:[UIColor greenColor]]; 40 | [graphView setFillColor:[UIColor orangeColor]]; 41 | [graphView setLineWidth:2]; 42 | [graphView setCurvedLines:YES]; 43 | [self.view addSubview:graphView]; 44 | 45 | // setting up a border around the view. for this you need to: #import 46 | //[graphView.layer setBorderColor:[UIColor redColor].CGColor]; 47 | //[graphView.layer setBorderWidth:2]; 48 | 49 | // button images 50 | UIImage *buttonImage = [[UIImage imageNamed:@"orangeButton.png"] 51 | resizableImageWithCapInsets:UIEdgeInsetsMake(18, 18, 18, 18)]; 52 | UIImage *buttonImageHighlight = [[UIImage imageNamed:@"orangeButtonHighlight.png"] 53 | resizableImageWithCapInsets:UIEdgeInsetsMake(18, 18, 18, 18)]; 54 | 55 | // set up button for pre defined array 56 | UIButton *setArray = [[UIButton alloc]initWithFrame: CGRectMake((self.view.frame.size.width/2)-80, 200, 160, 40)]; 57 | [setArray setTitle:@"Set Array" forState:UIControlStateNormal]; 58 | [setArray setBackgroundImage:buttonImage forState:UIControlStateNormal]; 59 | [setArray setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 60 | [setArray addTarget:self action:@selector(setArrayButtonAction) forControlEvents:UIControlEventTouchUpInside]; 61 | [self.view addSubview:setArray]; 62 | 63 | // set up button for points 64 | UIButton *setPoint = [[UIButton alloc]initWithFrame: CGRectMake((self.view.frame.size.width/2)-80, 250, 160, 40)]; 65 | [setPoint setTitle:@"Set Points" forState:UIControlStateNormal]; 66 | [setPoint setBackgroundImage:buttonImage forState:UIControlStateNormal]; 67 | [setPoint setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 68 | [setPoint addTarget:self action:@selector(setPointButtonAction) forControlEvents:UIControlEventTouchUpInside]; 69 | [self.view addSubview:setPoint]; 70 | 71 | // set up button for resetting array 72 | UIButton *resetGraph = [[UIButton alloc]initWithFrame: CGRectMake((self.view.frame.size.width/2)-80, 300, 160, 40)]; 73 | [resetGraph setTitle:@"Reset Graph" forState:UIControlStateNormal]; 74 | [resetGraph setBackgroundImage:buttonImage forState:UIControlStateNormal]; 75 | [resetGraph setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 76 | [resetGraph addTarget:self action:@selector(resetGraphButtonAction) forControlEvents:UIControlEventTouchUpInside]; 77 | [self.view addSubview:resetGraph]; 78 | 79 | // set up button for adding points 80 | UIButton *setVisiblePoints = [[UIButton alloc]initWithFrame: CGRectMake((self.view.frame.size.width/2)-80, 350, 160, 40)]; 81 | [setVisiblePoints setTitle:@"Set Visible Points" forState:UIControlStateNormal]; 82 | [setVisiblePoints setBackgroundImage:buttonImage forState:UIControlStateNormal]; 83 | [setVisiblePoints setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 84 | [setVisiblePoints addTarget:self action:@selector(numberOfPointsVisible) forControlEvents:UIControlEventTouchUpInside]; 85 | [self.view addSubview:setVisiblePoints]; 86 | 87 | // set up button for filling space below graph line 88 | UIButton *setFilling = [[UIButton alloc]initWithFrame: CGRectMake((self.view.frame.size.width/2)-150, 400, 140, 40)]; 89 | [setFilling setTitle:@"Fill Graph" forState:UIControlStateNormal]; 90 | [setFilling setBackgroundImage:buttonImage forState:UIControlStateNormal]; 91 | [setFilling setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 92 | [setFilling addTarget:self action:@selector(setFillingButtonAction) forControlEvents:UIControlEventTouchUpInside]; 93 | [self.view addSubview:setFilling]; 94 | 95 | // set up button for removing filling space below graph line 96 | UIButton *setNoFilling = [[UIButton alloc]initWithFrame: CGRectMake(self.view.frame.size.width-150, 400, 140, 40)]; 97 | [setNoFilling setTitle:@"Don't Fill Graph" forState:UIControlStateNormal]; 98 | [setNoFilling setBackgroundImage:buttonImage forState:UIControlStateNormal]; 99 | [setNoFilling setBackgroundImage:buttonImageHighlight forState:UIControlStateHighlighted]; 100 | [setNoFilling addTarget:self action:@selector(setNotFillingButtonAction) forControlEvents:UIControlEventTouchUpInside]; 101 | [self.view addSubview:setNoFilling]; 102 | 103 | visiblePoints = [[UITextField alloc]initWithFrame:CGRectMake((self.view.frame.size.width/2)-150, 355, 60, 30)]; 104 | [visiblePoints setTextAlignment:NSTextAlignmentCenter]; 105 | [visiblePoints setText:@"100"]; 106 | [visiblePoints setBorderStyle:UITextBorderStyleRoundedRect]; 107 | [visiblePoints setReturnKeyType:UIReturnKeyDone]; 108 | [visiblePoints setDelegate:self]; 109 | [self.view addSubview:visiblePoints]; 110 | } 111 | 112 | -(void)setArrayButtonAction { 113 | 114 | // set up array for diplay in graphView 115 | NSArray *points = @[@0.0f, 116 | @0.0f, 117 | @0.0f, 118 | @13.0f, 119 | @7.0f, 120 | @9.0f, 121 | @20.0f, 122 | @04, 123 | @0.0f, 124 | @0.0f, 125 | @0.0f, 126 | @0.0f, 127 | @0.0f, 128 | @0.0f, 129 | @0.0f, 130 | @0.0f, 131 | @0.0f, 132 | @0.0f, 133 | @0.0f, 134 | @0.0f, 135 | @0.0f, 136 | @0.0f, 137 | @0.0f, 138 | @1.0f, 139 | @2.0f, 140 | @3.0f, 141 | @4.0f, 142 | @5.0f, 143 | @6.0f, 144 | @7.0f, 145 | @8.0f, 146 | @9.0f, 147 | @10.0f, 148 | @11.0f, 149 | @12.0f, 150 | @13.0f, 151 | @14.0f, 152 | @13.0f, 153 | @12.0f, 154 | @11.0f, 155 | @10.0f, 156 | @9.0f, 157 | @8.0f, 158 | @7.0f, 159 | @6.0f, 160 | @5.0f, 161 | @4.0f, 162 | @3.0f, 163 | @2.0f, 164 | @1.0f]; 165 | 166 | [graphView setArray:points]; 167 | } 168 | 169 | -(void)setPointButtonAction { 170 | 171 | // generate random numbers between +100 and -100 172 | float low_bound = -100.00; 173 | float high_bound = 100.00; 174 | float rndValue = (((float)arc4random()/0x100000000)*(high_bound-low_bound)+low_bound); 175 | int intRndValue = (int)(rndValue + 0.5); 176 | 177 | [graphView setPoint:intRndValue]; 178 | 179 | } 180 | 181 | -(void)resetGraphButtonAction { 182 | 183 | [graphView resetGraph]; 184 | } 185 | 186 | -(void)numberOfPointsVisible { 187 | 188 | 189 | [graphView setNumberOfPointsInGraph:[[NSString stringWithString: visiblePoints.text]floatValue]]; // change the int of points from textField 190 | 191 | 192 | } 193 | 194 | -(void)setFillingButtonAction { 195 | 196 | [graphView setFill:YES]; 197 | } 198 | 199 | -(void)setNotFillingButtonAction { 200 | 201 | [graphView setFill:NO]; 202 | } 203 | 204 | -(void)textFieldDidBeginEditing:(UITextField *)textField { 205 | 206 | NSTimeInterval animationDuration = 0.3; 207 | CGRect frame = self.view.frame; 208 | frame.origin.y -= 216-44; 209 | frame.size.height += 216-44; 210 | [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; 211 | [UIView setAnimationDuration:animationDuration]; 212 | self.view.frame = frame; 213 | [UIView commitAnimations]; 214 | 215 | } 216 | 217 | -(BOOL)textFieldShouldReturn:(UITextField *)textField { 218 | 219 | if ([visiblePoints.text isEqualToString: @""]) { 220 | [visiblePoints setText:@"100"]; 221 | } 222 | 223 | NSTimeInterval animationDuration = 0.3; 224 | CGRect frame = self.view.frame; 225 | frame.origin.y += 216-44; 226 | frame.size.height -= 216-44; 227 | [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; 228 | [UIView setAnimationDuration:animationDuration]; 229 | self.view.frame = frame; 230 | [UIView commitAnimations]; 231 | 232 | [textField resignFirstResponder]; 233 | 234 | return YES; 235 | } 236 | 237 | - (void)didReceiveMemoryWarning 238 | { 239 | [super didReceiveMemoryWarning]; 240 | // Dispose of any resources that can be recreated. 241 | } 242 | 243 | @end 244 | -------------------------------------------------------------------------------- /DynamicGraphView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /DynamicGraphView/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12A269 6 | 2835 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1919 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 548}} 37 | 38 | 39 | 40 | 41 | 3 42 | MC43NQA 43 | 44 | 2 45 | 46 | 47 | NO 48 | 49 | 50 | IBUIScreenMetrics 51 | 52 | YES 53 | 54 | 55 | 56 | 57 | 58 | {320, 568} 59 | {568, 320} 60 | 61 | 62 | IBCocoaTouchFramework 63 | Retina 4 Full Screen 64 | 2 65 | 66 | IBCocoaTouchFramework 67 | 68 | 69 | 70 | 71 | 72 | 73 | view 74 | 75 | 76 | 77 | 7 78 | 79 | 80 | 81 | 82 | 83 | 0 84 | 85 | 86 | 87 | 88 | 89 | -1 90 | 91 | 92 | File's Owner 93 | 94 | 95 | -2 96 | 97 | 98 | 99 | 100 | 6 101 | 102 | 103 | 104 | 105 | 106 | 107 | ViewController 108 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 109 | UIResponder 110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 111 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 | 113 | 114 | 115 | 116 | 117 | 7 118 | 119 | 120 | 121 | 122 | ViewController 123 | UIViewController 124 | 125 | IBProjectSource 126 | ./Classes/ViewController.h 127 | 128 | 129 | 130 | 131 | 0 132 | IBCocoaTouchFramework 133 | YES 134 | 3 135 | YES 136 | 1919 137 | 138 | 139 | -------------------------------------------------------------------------------- /DynamicGraphView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DynamicGraphView 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DynamicGraphView/orangeButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/orangeButton.png -------------------------------------------------------------------------------- /DynamicGraphView/orangeButton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/orangeButton@2x.png -------------------------------------------------------------------------------- /DynamicGraphView/orangeButtonHighlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/orangeButtonHighlight.png -------------------------------------------------------------------------------- /DynamicGraphView/orangeButtonHighlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freshking/DynamicGraphView/466d9fa66e6d8bed9ea7f9bac7e74361cfd61999/DynamicGraphView/orangeButtonHighlight@2x.png -------------------------------------------------------------------------------- /DynamicGraphViewTests/DynamicGraphViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | Bastian-Kohlbauer.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /DynamicGraphViewTests/DynamicGraphViewTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // DynamicGraphViewTests.h 3 | // DynamicGraphViewTests 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DynamicGraphViewTests : SenTestCase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DynamicGraphViewTests/DynamicGraphViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DynamicGraphViewTests.m 3 | // DynamicGraphViewTests 4 | // 5 | // Created by Bastian Kohlbauer on 08.06.13. 6 | // Copyright (c) 2013 Bastian Kohlbauer. All rights reserved. 7 | // 8 | 9 | #import "DynamicGraphViewTests.h" 10 | 11 | @implementation DynamicGraphViewTests 12 | 13 | - (void)setUp 14 | { 15 | [super setUp]; 16 | 17 | // Set-up code here. 18 | } 19 | 20 | - (void)tearDown 21 | { 22 | // Tear-down code here. 23 | 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample 28 | { 29 | STFail(@"Unit tests are not implemented yet in DynamicGraphViewTests"); 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DynamicGraphViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Bastian Kohlbauer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DynamicGraphView 2 | ================ 3 | 4 | A simple but effective dynamic GraphView implementation for iPhone SDK for float values. 5 | 6 | The left image shows a graph with only positive values and without curved lines. The right graph draws from positve and negative values and has the option for curved lines activated. 7 | 8 | ![Screenshot](http://i.imgur.com/Kur98cx.png)-----![Screenshot](http://i.imgur.com/uN8ddq8.jpg) 9 | 10 | Implementing this control into your project is very easy. 11 | 12 | #####1) Copy both GraphView.h and GraphView.m into your projet resources. 13 | 14 | #####2) In your ViewController.h: 15 | 16 | 17 | import 18 | import "GraphView.h" 19 | 20 | 21 | @interface ViewController : UIViewController { 22 | 23 | GraphView *graphView; 24 | 25 | } 26 | 27 | @property (strong, nonatomic) GraphView *graphView; 28 | 29 | @end 30 | 31 | #####3) In your ViewController.m: 32 | 33 | - (void)viewDidLoad 34 | { 35 | graphView = [[GraphView alloc]initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, 180)]; 36 | [graphView setBackgroundColor:[UIColor yellowColor]]; 37 | [graphView setSpacing:10]; 38 | [graphView setFill:YES]; 39 | [graphView setStrokeColor:[UIColor redColor]]; 40 | [graphView setZeroLineStrokeColor:[UIColor greenColor]]; 41 | [graphView setFillColor:[UIColor orangeColor]]; 42 | [graphView setLineWidth:2]; 43 | [graphView setCurvedLines:YES]; 44 | [self.view addSubview:graphView]; 45 | } 46 | 47 | Done! 48 | 49 | #####To control the graph, use following functions: 50 | 51 | 1) This will display a graph of float values: 52 | 53 | [graphView setArray:(NSArray)] 54 | 55 | 2) This will add a point to the graph. You can add as many as you like and even do this dynamically. The graph will update every time a new value has been added: 56 | 57 | [graphView setPoint:(float)] 58 | 59 | 3) This will reset the graph to all 0 values: 60 | 61 | [graphView resetGraph] 62 | 63 | 4) This sets the number of values displayed in the graph: 64 | 65 | [graphView setNumberOfPointsInGraph:(int)] 66 | 67 | 5) This will make the space beneth the graph line fill or not: 68 | 69 | [graphView setFill:(BOOL)] 70 | 71 | Thats all! 72 | 73 | If you have any more question, please read the comments in GraphView.h and GraphView.m or send me a message. 74 | 75 | Please concider the MIT License agreement. 76 | 77 | --------------------------------------------------------------------------------