-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added preliminary charting using Google Charts
- Loading branch information
1 parent
68f3beb
commit e352bbc
Showing
26 changed files
with
1,663 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Chart.h | ||
// iAbetes | ||
// | ||
// Created by chris nielubowicz on 2/19/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface Chart : UIViewController <UIWebViewDelegate> | ||
{ | ||
IBOutlet UIWebView *chartView; | ||
NSURL *chartURL; | ||
NSArray *data; | ||
} | ||
|
||
@property (nonatomic, retain) IBOutlet UIWebView *chartView; | ||
@property (nonatomic, retain) NSArray *data; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Chart.m | ||
// iAbetes | ||
// | ||
// Created by chris nielubowicz on 2/19/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "Chart.h" | ||
#import "ChartFormatter.h" | ||
|
||
@implementation Chart | ||
|
||
@synthesize chartView, data; | ||
|
||
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | ||
{ | ||
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) | ||
{ | ||
} | ||
return self; | ||
} | ||
|
||
-(void)viewDidLoad | ||
{ | ||
ChartFormatter *format = [[[ChartFormatter alloc] init] autorelease]; | ||
chartURL = [NSURL URLWithString:[format urlForData:data]]; | ||
NSLog(@"chartURL:\n%@", [chartURL description]); | ||
[chartView loadRequest:[NSURLRequest requestWithURL:chartURL]]; | ||
} | ||
|
||
-(void)dealloc | ||
{ | ||
[chartView setDelegate:nil]; | ||
[chartView release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03"> | ||
<data> | ||
<int key="IBDocument.SystemTarget">784</int> | ||
<string key="IBDocument.SystemVersion">9L30</string> | ||
<string key="IBDocument.InterfaceBuilderVersion">680</string> | ||
<string key="IBDocument.AppKitVersion">949.54</string> | ||
<string key="IBDocument.HIToolboxVersion">353.00</string> | ||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<integer value="1"/> | ||
</object> | ||
<object class="NSArray" key="IBDocument.PluginDependencies"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | ||
</object> | ||
<object class="NSMutableDictionary" key="IBDocument.Metadata"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
</object> | ||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBProxyObject" id="372490531"> | ||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string> | ||
</object> | ||
<object class="IBProxyObject" id="975951072"> | ||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string> | ||
</object> | ||
<object class="IBUIView" id="191373211"> | ||
<reference key="NSNextResponder"/> | ||
<int key="NSvFlags">292</int> | ||
<object class="NSMutableArray" key="NSSubviews"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBUIWebView" id="733213800"> | ||
<reference key="NSNextResponder" ref="191373211"/> | ||
<int key="NSvFlags">274</int> | ||
<string key="NSFrame">{{20, 123}, {280, 259}}</string> | ||
<reference key="NSSuperview" ref="191373211"/> | ||
<object class="NSColor" key="IBUIBackgroundColor"> | ||
<int key="NSColorSpace">1</int> | ||
<bytes key="NSRGB">MSAxIDEAA</bytes> | ||
</object> | ||
<bool key="IBUIClipsSubviews">YES</bool> | ||
<bool key="IBUIMultipleTouchEnabled">YES</bool> | ||
<int key="IBUIDataDetectorTypes">1</int> | ||
<bool key="IBUIDetectsPhoneNumbers">YES</bool> | ||
</object> | ||
</object> | ||
<string key="NSFrameSize">{320, 460}</string> | ||
<reference key="NSSuperview"/> | ||
<object class="NSColor" key="IBUIBackgroundColor"> | ||
<int key="NSColorSpace">1</int> | ||
<bytes key="NSRGB">MC42NzIyMjIyNiAxIDAuMzQ0NDQ0NDUAA</bytes> | ||
</object> | ||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> | ||
</object> | ||
</object> | ||
<object class="IBObjectContainer" key="IBDocument.Objects"> | ||
<object class="NSMutableArray" key="connectionRecords"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBConnectionRecord"> | ||
<object class="IBCocoaTouchOutletConnection" key="connection"> | ||
<string key="label">view</string> | ||
<reference key="source" ref="372490531"/> | ||
<reference key="destination" ref="191373211"/> | ||
</object> | ||
<int key="connectionID">3</int> | ||
</object> | ||
<object class="IBConnectionRecord"> | ||
<object class="IBCocoaTouchOutletConnection" key="connection"> | ||
<string key="label">chartView</string> | ||
<reference key="source" ref="372490531"/> | ||
<reference key="destination" ref="733213800"/> | ||
</object> | ||
<int key="connectionID">8</int> | ||
</object> | ||
<object class="IBConnectionRecord"> | ||
<object class="IBCocoaTouchOutletConnection" key="connection"> | ||
<string key="label">delegate</string> | ||
<reference key="source" ref="733213800"/> | ||
<reference key="destination" ref="372490531"/> | ||
</object> | ||
<int key="connectionID">9</int> | ||
</object> | ||
</object> | ||
<object class="IBMutableOrderedSet" key="objectRecords"> | ||
<object class="NSArray" key="orderedObjects"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">0</int> | ||
<object class="NSArray" key="object" id="1009648848"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
<reference key="children" ref="1000"/> | ||
<nil key="parent"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">1</int> | ||
<reference key="object" ref="191373211"/> | ||
<object class="NSMutableArray" key="children"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<reference ref="733213800"/> | ||
</object> | ||
<reference key="parent" ref="1009648848"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">-1</int> | ||
<reference key="object" ref="372490531"/> | ||
<reference key="parent" ref="1009648848"/> | ||
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">-2</int> | ||
<reference key="object" ref="975951072"/> | ||
<reference key="parent" ref="1009648848"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">7</int> | ||
<reference key="object" ref="733213800"/> | ||
<reference key="parent" ref="191373211"/> | ||
</object> | ||
</object> | ||
</object> | ||
<object class="NSMutableDictionary" key="flattenedProperties"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSMutableArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>-1.CustomClassName</string> | ||
<string>-2.CustomClassName</string> | ||
<string>1.IBEditorWindowLastContentRect</string> | ||
<string>1.IBPluginDependency</string> | ||
<string>7.IBPluginDependency</string> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>Chart</string> | ||
<string>UIResponder</string> | ||
<string>{{481, 412}, {320, 480}}</string> | ||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | ||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | ||
</object> | ||
</object> | ||
<object class="NSMutableDictionary" key="unlocalizedProperties"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
</object> | ||
<nil key="activeLocalization"/> | ||
<object class="NSMutableDictionary" key="localizations"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
</object> | ||
<nil key="sourceID"/> | ||
<int key="maxID">9</int> | ||
</object> | ||
<object class="IBClassDescriber" key="IBDocument.Classes"> | ||
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBPartialClassDescription"> | ||
<string key="className">Chart</string> | ||
<string key="superclassName">UIViewController</string> | ||
<object class="NSMutableDictionary" key="outlets"> | ||
<string key="NS.key.0">chartView</string> | ||
<string key="NS.object.0">UIWebView</string> | ||
</object> | ||
<object class="IBClassDescriptionSource" key="sourceIdentifier"> | ||
<string key="majorKey">IBProjectSource</string> | ||
<string key="minorKey">Classes/charting/Chart.h</string> | ||
</object> | ||
</object> | ||
</object> | ||
</object> | ||
<int key="IBDocument.localizationMode">0</int> | ||
<string key="IBDocument.LastKnownRelativeProjectPath">../../iAbetes.xcodeproj</string> | ||
<int key="IBDocument.defaultPropertyAccessControl">3</int> | ||
<string key="IBCocoaTouchPluginVersion">3.1</string> | ||
</data> | ||
</archive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ChartFormatter.h | ||
// iAbetes | ||
// | ||
// Created by chris nielubowicz on 2/19/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface ChartFormatter : NSObject { | ||
|
||
} | ||
|
||
-(NSString *)urlForData:(NSArray *)logEntries; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// ChartFormatter.m | ||
// iAbetes | ||
// | ||
// Created by chris nielubowicz on 2/19/11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "ChartFormatter.h" | ||
#import "LogEntry.h" | ||
|
||
@implementation ChartFormatter | ||
|
||
-(id)init | ||
{ | ||
if (self = [super init]) | ||
{ | ||
|
||
} | ||
return self; | ||
} | ||
|
||
-(NSString *)urlForData:(NSArray *)logEntries | ||
{ | ||
NSMutableString *dataString = [NSMutableString string]; | ||
NSSortDescriptor *sort = [[[NSSortDescriptor alloc] initWithKey:@"timeOfEntry" ascending:YES] autorelease]; | ||
NSArray *timeSortedArray = [logEntries sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]]; | ||
NSLog(@"sort : %@", [timeSortedArray description]); | ||
for (LogEntry *log in timeSortedArray) | ||
{ | ||
[dataString appendFormat:@"%d,", [log bloodSugar]]; | ||
} | ||
return [NSString stringWithFormat:@"https://chart.googleapis.com/chart?cht=lc&chd=t:%@&chds=20,500&chs=280x250&chxt=y&chxr=0,20,500", [dataString substringToIndex:[dataString length]-1]]; | ||
} | ||
|
||
-(void)dealloc | ||
{ | ||
[super dealloc]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.