Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Eliminates dependency on custom font. (I try to use preinstalled font…

…s whenever possible, to conserve space).

Permits font customization for various line chart elements.

Permits custom min/max "Y" values for line charts, to allow for negative data points. (Changed sample data to test this).

Permits the omission of value labels on line chart.

Adds a light grey shadow for line chart, to help lines/labels "pop" a little.

Uses customizable UIColor properties instead of repeatedly recreating CGColors from arrays of floats.

Uses NSSortDescriptor to sort arrays of dictionaries.

Uses JSONKit instead of SBJSON for speed and simplicity.
  • Loading branch information...
commit 87fe22898af7ca0a40e7139f6058ab09801c70ac 1 parent d6c3f1d
@grgcombs grgcombs authored
View
6 .gitmodules
@@ -1,3 +1,3 @@
-[submodule "iOSPlot/SBJSON"]
- path = iOSPlot/SBJSON
- url = git@github.com:honcheng/SBJSON-library.git
+[submodule "iOSPlot/JSONKit"]
+ path = iOSPlot/JSONKit
+ url = git://github.com/johnezang/JSONKit.git
View
BIN  iOSPlot/HelveticaNeue.ttc
Binary file not shown
1  iOSPlot/JSONKit
@@ -0,0 +1 @@
+Subproject commit b8359c61d82416fb8db55d263f68c26d8d929d59
View
110 iOSPlot/PlotCreator.xcodeproj/project.pbxproj
@@ -15,7 +15,7 @@
2860E32E111B888700E27156 /* AppDelegate_iPad.m in Sources */ = {isa = PBXBuildFile; fileRef = 2860E32C111B888700E27156 /* AppDelegate_iPad.m */; };
2860E32F111B888700E27156 /* MainWindow_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2860E32D111B888700E27156 /* MainWindow_iPad.xib */; };
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
- F8325FC91363CE810045F9DC /* HelveticaNeue.ttc in Resources */ = {isa = PBXBuildFile; fileRef = F8325FC81363CE810045F9DC /* HelveticaNeue.ttc */; };
+ 3794799813706B8400C0E457 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 3794799713706B8400C0E457 /* JSONKit.m */; };
F832606A1363D49B0045F9DC /* ChartListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F83260691363D49B0045F9DC /* ChartListViewController.m */; };
F83260901363D5CF0045F9DC /* GenericViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F832608F1363D5CF0045F9DC /* GenericViewController.m */; };
F83260AA1363D8170045F9DC /* back_button.png in Resources */ = {isa = PBXBuildFile; fileRef = F83260A81363D8170045F9DC /* back_button.png */; };
@@ -26,12 +26,6 @@
F897D6EE13630F560025FE6E /* sample_piechart_data.plist in Resources */ = {isa = PBXBuildFile; fileRef = F897D6ED13630F560025FE6E /* sample_piechart_data.plist */; };
F897D6F113630FD40025FE6E /* PCPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = F897D6F013630FD40025FE6E /* PCPieChart.m */; };
F897D700136311E60025FE6E /* PieChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F897D6FF136311E60025FE6E /* PieChartViewController.m */; };
- F8C1B415136F7FC8002DDF6C /* NSObject+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B40A136F7FC8002DDF6C /* NSObject+SBJSON.m */; };
- F8C1B416136F7FC8002DDF6C /* NSString+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B40C136F7FC8002DDF6C /* NSString+SBJSON.m */; };
- F8C1B417136F7FC8002DDF6C /* SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B40E136F7FC8002DDF6C /* SBJSON.m */; };
- F8C1B418136F7FC8002DDF6C /* SBJsonBase.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B410136F7FC8002DDF6C /* SBJsonBase.m */; };
- F8C1B419136F7FC8002DDF6C /* SBJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B412136F7FC8002DDF6C /* SBJsonParser.m */; };
- F8C1B41A136F7FC8002DDF6C /* SBJsonWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = F8C1B414136F7FC8002DDF6C /* SBJsonWriter.m */; };
F8C1B41C136F8056002DDF6C /* sample_linechart_data.json in Resources */ = {isa = PBXBuildFile; fileRef = F8C1B41B136F8056002DDF6C /* sample_linechart_data.json */; };
/* End PBXBuildFile section */
@@ -48,38 +42,26 @@
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Shared/main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* PlotCreator_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlotCreator_Prefix.pch; sourceTree = "<group>"; };
+ 3794799613706B8400C0E457 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONKit.h; path = JSONKit/JSONKit.h; sourceTree = "<group>"; };
+ 3794799713706B8400C0E457 /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSONKit.m; path = JSONKit/JSONKit.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* PlotCreator-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "PlotCreator-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
- F8325FC81363CE810045F9DC /* HelveticaNeue.ttc */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelveticaNeue.ttc; sourceTree = "<group>"; };
- F83260681363D49B0045F9DC /* ChartListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartListViewController.h; sourceTree = "<group>"; };
- F83260691363D49B0045F9DC /* ChartListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChartListViewController.m; sourceTree = "<group>"; };
- F832608E1363D5CF0045F9DC /* GenericViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericViewController.h; sourceTree = "<group>"; };
- F832608F1363D5CF0045F9DC /* GenericViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GenericViewController.m; sourceTree = "<group>"; };
+ F83260681363D49B0045F9DC /* ChartListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartListViewController.h; path = iPhone/ChartListViewController.h; sourceTree = "<group>"; };
+ F83260691363D49B0045F9DC /* ChartListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ChartListViewController.m; path = iPhone/ChartListViewController.m; sourceTree = "<group>"; };
+ F832608E1363D5CF0045F9DC /* GenericViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericViewController.h; path = iPhone/GenericViewController.h; sourceTree = "<group>"; };
+ F832608F1363D5CF0045F9DC /* GenericViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GenericViewController.m; path = iPhone/GenericViewController.m; sourceTree = "<group>"; };
F83260A81363D8170045F9DC /* back_button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = back_button.png; path = Images/back_button.png; sourceTree = "<group>"; };
F83260A91363D8170045F9DC /* back_button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "back_button@2x.png"; path = "Images/back_button@2x.png"; sourceTree = "<group>"; };
- F83260C01363D91E0045F9DC /* PieChartViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PieChartViewController2.h; sourceTree = "<group>"; };
- F83260C11363D91E0045F9DC /* PieChartViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PieChartViewController2.m; sourceTree = "<group>"; };
+ F83260C01363D91E0045F9DC /* PieChartViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PieChartViewController2.h; path = iPhone/PieChartViewController2.h; sourceTree = "<group>"; };
+ F83260C11363D91E0045F9DC /* PieChartViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PieChartViewController2.m; path = iPhone/PieChartViewController2.m; sourceTree = "<group>"; };
F88CC4C613684F0E0096327F /* PCLineChartView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PCLineChartView.h; path = Shared/PCLineChartView.h; sourceTree = "<group>"; };
F88CC4C713684F0E0096327F /* PCLineChartView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PCLineChartView.m; path = Shared/PCLineChartView.m; sourceTree = "<group>"; };
- F88CC4D113684FD30096327F /* LineChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineChartViewController.h; sourceTree = "<group>"; };
- F88CC4D213684FD30096327F /* LineChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LineChartViewController.m; sourceTree = "<group>"; };
+ F88CC4D113684FD30096327F /* LineChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LineChartViewController.h; path = iPhone/LineChartViewController.h; sourceTree = "<group>"; };
+ F88CC4D213684FD30096327F /* LineChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LineChartViewController.m; path = iPhone/LineChartViewController.m; sourceTree = "<group>"; };
F897D6ED13630F560025FE6E /* sample_piechart_data.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = sample_piechart_data.plist; path = "Sample Data/sample_piechart_data.plist"; sourceTree = "<group>"; };
F897D6EF13630FD40025FE6E /* PCPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PCPieChart.h; path = Shared/PCPieChart.h; sourceTree = "<group>"; };
F897D6F013630FD40025FE6E /* PCPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PCPieChart.m; path = Shared/PCPieChart.m; sourceTree = "<group>"; };
- F897D6FE136311E60025FE6E /* PieChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PieChartViewController.h; sourceTree = "<group>"; };
- F897D6FF136311E60025FE6E /* PieChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PieChartViewController.m; sourceTree = "<group>"; };
- F8C1B408136F7FC8002DDF6C /* JSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSON.h; path = SBJSON/JSON/JSON.h; sourceTree = "<group>"; };
- F8C1B409136F7FC8002DDF6C /* NSObject+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+SBJSON.h"; path = "SBJSON/JSON/NSObject+SBJSON.h"; sourceTree = "<group>"; };
- F8C1B40A136F7FC8002DDF6C /* NSObject+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+SBJSON.m"; path = "SBJSON/JSON/NSObject+SBJSON.m"; sourceTree = "<group>"; };
- F8C1B40B136F7FC8002DDF6C /* NSString+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+SBJSON.h"; path = "SBJSON/JSON/NSString+SBJSON.h"; sourceTree = "<group>"; };
- F8C1B40C136F7FC8002DDF6C /* NSString+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+SBJSON.m"; path = "SBJSON/JSON/NSString+SBJSON.m"; sourceTree = "<group>"; };
- F8C1B40D136F7FC8002DDF6C /* SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBJSON.h; path = SBJSON/JSON/SBJSON.h; sourceTree = "<group>"; };
- F8C1B40E136F7FC8002DDF6C /* SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBJSON.m; path = SBJSON/JSON/SBJSON.m; sourceTree = "<group>"; };
- F8C1B40F136F7FC8002DDF6C /* SBJsonBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBJsonBase.h; path = SBJSON/JSON/SBJsonBase.h; sourceTree = "<group>"; };
- F8C1B410136F7FC8002DDF6C /* SBJsonBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBJsonBase.m; path = SBJSON/JSON/SBJsonBase.m; sourceTree = "<group>"; };
- F8C1B411136F7FC8002DDF6C /* SBJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBJsonParser.h; path = SBJSON/JSON/SBJsonParser.h; sourceTree = "<group>"; };
- F8C1B412136F7FC8002DDF6C /* SBJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBJsonParser.m; path = SBJSON/JSON/SBJsonParser.m; sourceTree = "<group>"; };
- F8C1B413136F7FC8002DDF6C /* SBJsonWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBJsonWriter.h; path = SBJSON/JSON/SBJsonWriter.h; sourceTree = "<group>"; };
- F8C1B414136F7FC8002DDF6C /* SBJsonWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBJsonWriter.m; path = SBJSON/JSON/SBJsonWriter.m; sourceTree = "<group>"; };
+ F897D6FE136311E60025FE6E /* PieChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PieChartViewController.h; path = iPhone/PieChartViewController.h; sourceTree = "<group>"; };
+ F897D6FF136311E60025FE6E /* PieChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PieChartViewController.m; path = iPhone/PieChartViewController.m; sourceTree = "<group>"; };
F8C1B41B136F8056002DDF6C /* sample_linechart_data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sample_linechart_data.json; path = "Sample Data/sample_linechart_data.json"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -111,16 +93,6 @@
2860E325111B887F00E27156 /* AppDelegate_iPhone.h */,
2860E326111B887F00E27156 /* AppDelegate_iPhone.m */,
2860E327111B887F00E27156 /* MainWindow_iPhone.xib */,
- F897D6FE136311E60025FE6E /* PieChartViewController.h */,
- F897D6FF136311E60025FE6E /* PieChartViewController.m */,
- F83260C01363D91E0045F9DC /* PieChartViewController2.h */,
- F83260C11363D91E0045F9DC /* PieChartViewController2.m */,
- F83260681363D49B0045F9DC /* ChartListViewController.h */,
- F83260691363D49B0045F9DC /* ChartListViewController.m */,
- F88CC4D113684FD30096327F /* LineChartViewController.h */,
- F88CC4D213684FD30096327F /* LineChartViewController.m */,
- F832608E1363D5CF0045F9DC /* GenericViewController.h */,
- F832608F1363D5CF0045F9DC /* GenericViewController.m */,
);
path = iPhone;
sourceTree = "<group>";
@@ -138,11 +110,18 @@
28EEBF621118D79A00187D67 /* Shared */ = {
isa = PBXGroup;
children = (
- F8C1B407136F7FB7002DDF6C /* SBJSON */,
- F897D6EF13630FD40025FE6E /* PCPieChart.h */,
- F897D6F013630FD40025FE6E /* PCPieChart.m */,
- F88CC4C613684F0E0096327F /* PCLineChartView.h */,
- F88CC4C713684F0E0096327F /* PCLineChartView.m */,
+ 3794799B13706BB200C0E457 /* iOSPlot */,
+ F8C1B407136F7FB7002DDF6C /* JSONKit */,
+ F897D6FE136311E60025FE6E /* PieChartViewController.h */,
+ F897D6FF136311E60025FE6E /* PieChartViewController.m */,
+ F83260C01363D91E0045F9DC /* PieChartViewController2.h */,
+ F83260C11363D91E0045F9DC /* PieChartViewController2.m */,
+ F83260681363D49B0045F9DC /* ChartListViewController.h */,
+ F83260691363D49B0045F9DC /* ChartListViewController.m */,
+ F88CC4D113684FD30096327F /* LineChartViewController.h */,
+ F88CC4D213684FD30096327F /* LineChartViewController.m */,
+ F832608E1363D5CF0045F9DC /* GenericViewController.h */,
+ F832608F1363D5CF0045F9DC /* GenericViewController.m */,
8D1107310486CEB800E47090 /* PlotCreator-Info.plist */,
);
name = Shared;
@@ -164,7 +143,6 @@
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
- F8325FC81363CE810045F9DC /* HelveticaNeue.ttc */,
F83260A81363D8170045F9DC /* back_button.png */,
F83260A91363D8170045F9DC /* back_button@2x.png */,
F897D6E513630F4B0025FE6E /* Sample Data */,
@@ -184,6 +162,17 @@
name = Frameworks;
sourceTree = "<group>";
};
+ 3794799B13706BB200C0E457 /* iOSPlot */ = {
+ isa = PBXGroup;
+ children = (
+ F897D6EF13630FD40025FE6E /* PCPieChart.h */,
+ F897D6F013630FD40025FE6E /* PCPieChart.m */,
+ F88CC4C613684F0E0096327F /* PCLineChartView.h */,
+ F88CC4C713684F0E0096327F /* PCLineChartView.m */,
+ );
+ name = iOSPlot;
+ sourceTree = "<group>";
+ };
F897D6E513630F4B0025FE6E /* Sample Data */ = {
isa = PBXGroup;
children = (
@@ -193,24 +182,13 @@
name = "Sample Data";
sourceTree = "<group>";
};
- F8C1B407136F7FB7002DDF6C /* SBJSON */ = {
+ F8C1B407136F7FB7002DDF6C /* JSONKit */ = {
isa = PBXGroup;
children = (
- F8C1B408136F7FC8002DDF6C /* JSON.h */,
- F8C1B409136F7FC8002DDF6C /* NSObject+SBJSON.h */,
- F8C1B40A136F7FC8002DDF6C /* NSObject+SBJSON.m */,
- F8C1B40B136F7FC8002DDF6C /* NSString+SBJSON.h */,
- F8C1B40C136F7FC8002DDF6C /* NSString+SBJSON.m */,
- F8C1B40D136F7FC8002DDF6C /* SBJSON.h */,
- F8C1B40E136F7FC8002DDF6C /* SBJSON.m */,
- F8C1B40F136F7FC8002DDF6C /* SBJsonBase.h */,
- F8C1B410136F7FC8002DDF6C /* SBJsonBase.m */,
- F8C1B411136F7FC8002DDF6C /* SBJsonParser.h */,
- F8C1B412136F7FC8002DDF6C /* SBJsonParser.m */,
- F8C1B413136F7FC8002DDF6C /* SBJsonWriter.h */,
- F8C1B414136F7FC8002DDF6C /* SBJsonWriter.m */,
+ 3794799613706B8400C0E457 /* JSONKit.h */,
+ 3794799713706B8400C0E457 /* JSONKit.m */,
);
- name = SBJSON;
+ name = JSONKit;
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -265,7 +243,6 @@
2860E329111B887F00E27156 /* MainWindow_iPhone.xib in Resources */,
2860E32F111B888700E27156 /* MainWindow_iPad.xib in Resources */,
F897D6EE13630F560025FE6E /* sample_piechart_data.plist in Resources */,
- F8325FC91363CE810045F9DC /* HelveticaNeue.ttc in Resources */,
F83260AA1363D8170045F9DC /* back_button.png in Resources */,
F83260AB1363D8170045F9DC /* back_button@2x.png in Resources */,
F8C1B41C136F8056002DDF6C /* sample_linechart_data.json in Resources */,
@@ -289,12 +266,7 @@
F83260C21363D91E0045F9DC /* PieChartViewController2.m in Sources */,
F88CC4C813684F0E0096327F /* PCLineChartView.m in Sources */,
F88CC4D313684FD30096327F /* LineChartViewController.m in Sources */,
- F8C1B415136F7FC8002DDF6C /* NSObject+SBJSON.m in Sources */,
- F8C1B416136F7FC8002DDF6C /* NSString+SBJSON.m in Sources */,
- F8C1B417136F7FC8002DDF6C /* SBJSON.m in Sources */,
- F8C1B418136F7FC8002DDF6C /* SBJsonBase.m in Sources */,
- F8C1B419136F7FC8002DDF6C /* SBJsonParser.m in Sources */,
- F8C1B41A136F7FC8002DDF6C /* SBJsonWriter.m in Sources */,
+ 3794799813706B8400C0E457 /* JSONKit.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1  iOSPlot/SBJSON
@@ -1 +0,0 @@
-Subproject commit 2cfbb4cca0b36b8acbc2bfb9690fcbcc32d2f559
View
16 iOSPlot/Sample Data/sample_linechart_data.json
@@ -9,7 +9,7 @@
69,
70
],
- "title": "AAA"
+ "title": "Smith"
},
{
"data": [
@@ -20,7 +20,7 @@
22,
30
],
- "title": "BBB"
+ "title": "Repub"
},
{
"data": [
@@ -28,10 +28,10 @@
55,
56,
66,
- 70,
- 70
+ 40,
+ -30
],
- "title": "CCC"
+ "title": "Dem"
},
{
"data": [
@@ -39,8 +39,8 @@
89,
90,
85,
- 90,
- 95
+ 60,
+ -15
],
"title": "DDD"
},
@@ -51,7 +51,7 @@
55,
33,
50,
- 46
+ -6
],
"title": "EEE"
}
View
28 iOSPlot/Shared/PCLineChartView.h
@@ -37,31 +37,37 @@
{
NSString *title;
NSArray *points;
- NSArray *colour;
+ UIColor *colour;
+ BOOL shouldLabelValues;
}
+@property (nonatomic, assign) BOOL shouldLabelValues;
@property (nonatomic, retain) NSArray *points;
-@property (nonatomic, retain) NSArray *colour;
+@property (nonatomic, retain) UIColor *colour;
@property (nonatomic, retain) NSString *title;
@end
-#define PCColorBlue [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0],[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:204/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorGreen [NSArray arrayWithObjects:[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:204/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorOrange [NSArray arrayWithObjects:[NSNumber numberWithFloat:1.0],[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorRed [NSArray arrayWithObjects:[NSNumber numberWithFloat:1.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorYellow [NSArray arrayWithObjects:[NSNumber numberWithFloat:255/255.0],[NSNumber numberWithFloat:220/255.0],[NSNumber numberWithFloat:0.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorDefault [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:1.0],nil]
+
+#define PCColorBlue [UIColor colorWithRed:0.0 green:153/255.0 blue:204/255.0 alpha:1.0]
+#define PCColorGreen [UIColor colorWithRed:153/255.0 green:204/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorOrange [UIColor colorWithRed:1.0 green:153/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorRed [UIColor colorWithRed:1.0 green:51/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorYellow [UIColor colorWithRed:1.0 green:220/255.0 blue:0.0 alpha:1.0]
+#define PCColorDefault [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]
@interface PCLineChartView : UIView {
NSMutableArray *components;
NSMutableArray *xLabels;
+ UIFont *yLabelFont, *xLabelFont, *valueLabelFont, *legendFont;
int interval;
+ float minValue;
+ float maxValue;
}
@property (nonatomic, assign) int interval;
+@property (nonatomic, assign) float minValue;
+@property (nonatomic, assign) float maxValue;
@property (nonatomic, retain) NSMutableArray *components, *xLabels;
-
-int sortByNumber(NSNumber *firstComponent, NSNumber *secondComponent, void*context);
-int sortLegend(NSMutableDictionary *firstComponent, NSMutableDictionary *secondComponent, void*context);
+@property (nonatomic, retain) UIFont *yLabelFont, *xLabelFont, *valueLabelFont, *legendFont;
@end
View
201 iOSPlot/Shared/PCLineChartView.m
@@ -34,13 +34,14 @@
#import "PCLineChartView.h"
@implementation PCLineChartViewComponent
-@synthesize title, points, colour;
+@synthesize title, points, colour, shouldLabelValues;
@end
@implementation PCLineChartView
@synthesize components;
-@synthesize interval;
+@synthesize interval, minValue, maxValue;
@synthesize xLabels;
+@synthesize yLabelFont, xLabelFont, valueLabelFont, legendFont;
- (id)initWithFrame:(CGRect)frame
{
@@ -49,92 +50,43 @@ - (id)initWithFrame:(CGRect)frame
// Initialization code
[self setBackgroundColor:[UIColor clearColor]];
- self.interval = 20;
+ interval = 20;
+ maxValue = 100;
+ minValue = 0;
+ yLabelFont = [[UIFont fontWithName:@"GeezaPro-Bold" size:14] retain];
+ xLabelFont = [[UIFont fontWithName:@"HiraKakuProN-W6" size:12] retain];
+ valueLabelFont = [[UIFont fontWithName:@"HiraKakuProN-W6" size:10] retain];
+ legendFont = [[UIFont fontWithName:@"HiraKakuProN-W6" size:10] retain];
+
}
return self;
}
- (void)drawRect:(CGRect)rect
-{
- // Drawing code
-
- //NSLog(@"%@", self.components);
- float max_value = 100;
- float min_value = 0;
-
- /*
- NSMutableArray *x_labels = [NSMutableArray array];
- NSMutableDictionary *percentages = [NSMutableDictionary dictionary];
-
- for (PCLineChartViewComponent *component in self.components)
- {
- for (NSMutableDictionary *point in component.points)
- {
- float value = [[point objectForKey:@"perc"] floatValue];
- if (value>0)
- {
- if (value>max_value) max_value = value;
- if (value<min_value && value>0) min_value = value;
-
- int x_label = [[point objectForKey:@"x_label"] intValue];
- NSNumber *label = [NSNumber numberWithInt:x_label];
- if ([x_labels indexOfObject:label]==NSNotFound)
- {
- [x_labels addObject:label];
- }
-
- NSString *x_label_key = [NSString stringWithFormat:@"%@", [point objectForKey:@"x_label"]];
- if (![percentages objectForKey:x_label_key])
- {
- [percentages setObject:[NSMutableArray array] forKey:x_label_key];
- }
- [[percentages objectForKey:x_label_key] addObject:[point objectForKey:@"perc"]];
- }
-
- }
- }*/
-
- /*
- for (int i=0; i<100; i+=self.interval)
- {
- if (i>max_value)
- {
- max_value = i;
- break;
- }
- }
-
- for (int i=100; i>=0; i-=self.interval)
- {
- if (i<min_value)
- {
- min_value = i;
- break;
- }
- }
-
- if (min_value==20) min_value = 10;*/
-
+{
CGContextRef ctx = UIGraphicsGetCurrentContext();
UIGraphicsPushContext(ctx);
CGContextSetRGBFillColor(ctx, 0.2f, 0.2f, 0.2f, 1.0f);
-
- int n_div = (max_value-min_value)/self.interval + 1;
+ int n_div = (maxValue-minValue)/self.interval + 1;
float top_margin = 35;
float bottom_margin = 25;
float x_label_height = 20;
float div_height = (self.frame.size.height-top_margin-bottom_margin-x_label_height)/(n_div-1);
-
+
for (int i=0; i<n_div; i++)
{
- float y_axis = max_value - i*self.interval;
-
+ float y_axis = maxValue - i*self.interval;
+
int y = top_margin + div_height*i;
CGRect textFrame = CGRectMake(0,y-8,25,20);
NSString *text = [NSString stringWithFormat:@"%.0f", y_axis];
- [text drawInRect:textFrame withFont:[UIFont systemFontOfSize:12] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentRight];
+ [text drawInRect:textFrame
+ withFont:yLabelFont
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentRight];
+ // These are "grid" lines
CGContextSetLineWidth(ctx, 1);
CGContextSetRGBStrokeColor(ctx, 0.4f, 0.4f, 0.4f, 0.1f);
CGContextMoveToPoint(ctx, 30, y);
@@ -149,21 +101,27 @@ - (void)drawRect:(CGRect)rect
int x = margin + div_width*i;
NSString *x_label = [NSString stringWithFormat:@"%@", [self.xLabels objectAtIndex:i]];
CGRect textFrame = CGRectMake(x-100, self.frame.size.height-x_label_height,200,x_label_height);
- [x_label drawInRect:textFrame withFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:14] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
+ [x_label drawInRect:textFrame
+ withFont:xLabelFont
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentCenter];
}
+ CGColorRef shadowColor = [[UIColor lightGrayColor] CGColor];
+ CGContextSetShadowWithColor(ctx, CGSizeMake(0,-1), 1, shadowColor);
NSMutableArray *legends = [NSMutableArray array];
float circle_diameter = 10;
float circle_stroke_width = 3;
float line_width = 4;
+
for (PCLineChartViewComponent *component in self.components)
{
int last_x = 0;
int last_y = 0;
-
+
for (int x_axis_index=0; x_axis_index<[component.points count]; x_axis_index++)
{
id object = [component.points objectAtIndex:x_axis_index];
@@ -172,19 +130,17 @@ - (void)drawRect:(CGRect)rect
if (object!=[NSNull null] && object)
{
float value = [object floatValue];
-
- NSArray *colour = component.colour;
-
- CGContextSetRGBStrokeColor(ctx, [[colour objectAtIndex:0] floatValue], [[colour objectAtIndex:1] floatValue], [[colour objectAtIndex:2] floatValue], [[colour objectAtIndex:3] floatValue]);
+
+ CGContextSetStrokeColorWithColor(ctx, [component.colour CGColor]);
CGContextSetLineWidth(ctx, circle_stroke_width);
int x = margin + div_width*x_axis_index;
- int y = top_margin + (max_value-value)/self.interval*div_height;
+ int y = top_margin + (maxValue-value)/self.interval*div_height;
CGRect circleRect = CGRectMake(x-circle_diameter/2, y-circle_diameter/2, circle_diameter,circle_diameter);
CGContextStrokeEllipseInRect(ctx, circleRect);
- CGContextSetRGBFillColor(ctx, [[colour objectAtIndex:0] floatValue], [[colour objectAtIndex:1] floatValue], [[colour objectAtIndex:2] floatValue], [[colour objectAtIndex:3] floatValue]);
+ CGContextSetFillColorWithColor(ctx, [component.colour CGColor]);
if (last_x!=0 && last_y!=0)
{
@@ -217,16 +173,11 @@ - (void)drawRect:(CGRect)rect
}
}
-
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- CGColorRef color = CGColorCreate(colorSpace, CGColorGetComponents([UIColor colorWithRed:1 green:1 blue:1 alpha:1].CGColor));
- CGContextSetShadowWithColor(ctx, CGSizeMake(0,-1), 1, color);
for (int i=0; i<[self.xLabels count]; i++)
{
- UIFont *font = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:13];
int y_level = top_margin;
-
+
for (int j=0; j<[components count]; j++)
{
NSArray *items = [[components objectAtIndex:j] points];
@@ -235,49 +186,60 @@ - (void)drawRect:(CGRect)rect
{
float value = [object floatValue];
int x = margin + div_width*i;
- int y = top_margin + (max_value-value)/self.interval*div_height;
- int y1 = y - circle_diameter/2 - font.pointSize;
+ int y = top_margin + (maxValue-value)/self.interval*div_height;
+ int y1 = y - circle_diameter/2 - valueLabelFont.pointSize;
int y2 = y + circle_diameter/2;
- if (y1 > y_level)
- {
- CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
- NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
- CGRect textFrame = CGRectMake(x-25,y1, 50,20);
- [perc_label drawInRect:textFrame withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
- y_level = y1 + 20;
- }
- else if (y2 < y_level+20 && y2 < self.frame.size.height-top_margin-bottom_margin)
- {
- CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
- NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
- CGRect textFrame = CGRectMake(x-25,y2, 50,20);
- [perc_label drawInRect:textFrame withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
- y_level = y2 + 20;
+ if ([[components objectAtIndex:j] shouldLabelValues]) {
+ if (y1 > y_level)
+ {
+ CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
+ NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
+ CGRect textFrame = CGRectMake(x-25,y1, 50,20);
+ [perc_label drawInRect:textFrame
+ withFont:valueLabelFont
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentCenter];
+ y_level = y1 + 20;
+ }
+ else if (y2 < y_level+20 && y2 < self.frame.size.height-top_margin-bottom_margin)
+ {
+ CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
+ NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
+ CGRect textFrame = CGRectMake(x-25,y2, 50,20);
+ [perc_label drawInRect:textFrame
+ withFont:valueLabelFont
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentCenter];
+ y_level = y2 + 20;
+ }
+ else
+ {
+ CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
+ NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
+ CGRect textFrame = CGRectMake(x-50,y-10, 50,20);
+ [perc_label drawInRect:textFrame
+ withFont:valueLabelFont
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentCenter];
+ y_level = y1 + 20;
+ }
}
- else
- {
- CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
- NSString *perc_label = [NSString stringWithFormat:@"%.1f%%", value];
- CGRect textFrame = CGRectMake(x-50,y-10, 50,20);
- [perc_label drawInRect:textFrame withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
- y_level = y1 + 20;
- }
-
if (y+circle_diameter/2>y_level) y_level = y+circle_diameter/2;
}
}
}
- [legends sortUsingFunction:&sortLegend context:NULL];
+ NSSortDescriptor *sortDesc = [NSSortDescriptor sortDescriptorWithKey:@"y" ascending:YES];
+ [legends sortUsingDescriptors:[NSArray arrayWithObject:sortDesc]];
+
//CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
float y_level = 0;
for (NSMutableDictionary *legend in legends)
{
- NSArray *colour = [legend objectForKey:@"colour"];
- CGContextSetRGBFillColor(ctx, [[colour objectAtIndex:0] floatValue], [[colour objectAtIndex:1] floatValue], [[colour objectAtIndex:2] floatValue], [[colour objectAtIndex:3] floatValue]);
-
+ UIColor *colour = [legend objectForKey:@"colour"];
+ CGContextSetFillColorWithColor(ctx, [colour CGColor]);
NSString *title = [legend objectForKey:@"title"];
float x = [[legend objectForKey:@"x"] floatValue];
@@ -288,7 +250,7 @@ - (void)drawRect:(CGRect)rect
}
CGRect textFrame = CGRectMake(x,y,margin,15);
- [title drawInRect:textFrame withFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:14]];
+ [title drawInRect:textFrame withFont:legendFont];
y_level = y + 15;
}
@@ -297,17 +259,8 @@ - (void)drawRect:(CGRect)rect
- (void)dealloc
{
[self.components release];
+ self.yLabelFont = self.xLabelFont = self.valueLabelFont = self.legendFont = nil;
[super dealloc];
}
-int sortByNumber(NSNumber *firstComponent, NSNumber *secondComponent, void*context)
-{
- return [secondComponent compare:firstComponent];
-}
-
-int sortLegend(NSMutableDictionary *firstComponent, NSMutableDictionary *secondComponent, void*context)
-{
- return [[firstComponent objectForKey:@"y"] compare:[secondComponent objectForKey:@"y"]];
-}
-
@end
View
16 iOSPlot/Shared/PCPieChart.h
@@ -38,11 +38,11 @@
{
float value, startDeg, endDeg;
NSString *title;
- NSArray *colour;
+ UIColor *colour;
}
@property (nonatomic, assign) float value, startDeg, endDeg;
-@property (nonatomic, retain) NSArray *colour;
+@property (nonatomic, retain) UIColor *colour;
@property (nonatomic, retain) NSString *title;
@@ -50,12 +50,12 @@
+ (id)pieComponentWithTitle:(NSString*)_title value:(float)_value;
@end
-#define PCColorBlue [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0],[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:204/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorGreen [NSArray arrayWithObjects:[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:204/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorOrange [NSArray arrayWithObjects:[NSNumber numberWithFloat:1.0],[NSNumber numberWithFloat:153/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorRed [NSArray arrayWithObjects:[NSNumber numberWithFloat:1.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:51/255.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorYellow [NSArray arrayWithObjects:[NSNumber numberWithFloat:255/255.0],[NSNumber numberWithFloat:220/255.0],[NSNumber numberWithFloat:0.0],[NSNumber numberWithFloat:1.0],nil]
-#define PCColorDefault [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:0.5],[NSNumber numberWithFloat:1.0],nil]
+#define PCColorBlue [UIColor colorWithRed:0.0 green:153/255.0 blue:204/255.0 alpha:1.0]
+#define PCColorGreen [UIColor colorWithRed:153/255.0 green:204/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorOrange [UIColor colorWithRed:1.0 green:153/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorRed [UIColor colorWithRed:1.0 green:51/255.0 blue:51/255.0 alpha:1.0]
+#define PCColorYellow [UIColor colorWithRed:1.0 green:220/255.0 blue:0.0 alpha:1.0]
+#define PCColorDefault [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]
@interface PCPieChart : UIView {
NSMutableArray *components;
View
13 iOSPlot/Shared/PCPieChart.m
@@ -76,8 +76,8 @@ - (id)initWithFrame:(CGRect)frame
// Initialization code
[self setBackgroundColor:[UIColor clearColor]];
- self.titleFont = [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:10];//[UIFont boldSystemFontOfSize:20];
- self.percentageFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:25];//[UIFont boldSystemFontOfSize:14];
+ self.titleFont = [UIFont fontWithName:@"GeezaPro" size:10];//[UIFont boldSystemFontOfSize:20];
+ self.percentageFont = [UIFont fontWithName:@"HiraKakuProN-W6" size:20];//[UIFont boldSystemFontOfSize:14];
self.showArrow = YES;
self.sameColorLabel = NO;
@@ -127,7 +127,6 @@ - (void)drawRect:(CGRect)rect
UIGraphicsPopContext();
CGContextSetShadow(ctx, CGSizeMake(0.0f, 0.0f), 0);
-
float nextStartDeg = 0;
float endDeg = 0;
NSMutableArray *tmpComponents = [NSMutableArray array];
@@ -138,7 +137,7 @@ - (void)drawRect:(CGRect)rect
float perc = [component value]/total;
endDeg = nextStartDeg+perc*360;
- CGContextSetRGBFillColor(ctx, [[component.colour objectAtIndex:0] floatValue], [[component.colour objectAtIndex:1] floatValue], [[component.colour objectAtIndex:2] floatValue], [[component.colour objectAtIndex:3] floatValue]);
+ CGContextSetFillColorWithColor(ctx, [component.colour CGColor]);
CGContextMoveToPoint(ctx, origin_x, origin_y);
CGContextAddArc(ctx, origin_x, origin_y, inner_radius, (nextStartDeg-90)*M_PI/180.0, (endDeg-90)*M_PI/180.0, 0);
CGContextClosePath(ctx);
@@ -189,7 +188,7 @@ - (void)drawRect:(CGRect)rect
// display percentage label
if (self.sameColorLabel)
{
- CGContextSetRGBFillColor(ctx, [[component.colour objectAtIndex:0] floatValue], [[component.colour objectAtIndex:1] floatValue], [[component.colour objectAtIndex:2] floatValue], [[component.colour objectAtIndex:3] floatValue]);
+ CGContextSetFillColorWithColor(ctx, [component.colour CGColor]);
}
else
{
@@ -321,7 +320,7 @@ - (void)drawRect:(CGRect)rect
// display percentage label
if (self.sameColorLabel)
{
- CGContextSetRGBFillColor(ctx, [[component.colour objectAtIndex:0] floatValue], [[component.colour objectAtIndex:1] floatValue], [[component.colour objectAtIndex:2] floatValue], [[component.colour objectAtIndex:3] floatValue]);
+ CGContextSetFillColorWithColor(ctx, [component.colour CGColor]);
//CGContextSetRGBStrokeColor(ctx, 1.0f, 1.0f, 1.0f, 0.5);
//CGContextSetTextDrawingMode(ctx, kCGTextFillStroke);
}
@@ -424,7 +423,7 @@ - (void)drawRect:(CGRect)rect
}
}
}
-
+
// display title on the left
CGContextSetRGBFillColor(ctx, 0.4f, 0.4f, 0.4f, 1.0f);
right_label_y += optimumSize.height - 4;
View
6 iOSPlot/iPhone/ChartListViewController.m
@@ -51,7 +51,7 @@ - (id)init
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,150,30)];
[titleLabel setBackgroundColor:[UIColor clearColor]];
[titleLabel setTextColor:[UIColor whiteColor]];
- [titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:20]];
+ [titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:16]];
[titleLabel setText:@"iOSPlot"];
[self.navigationItem setTitleView:titleLabel];
[titleLabel release];
@@ -89,7 +89,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- [cell.textLabel setFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:20]];
+ [cell.textLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:16]];
[cell setSelectionStyle:UITableViewCellSelectionStyleGray];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
@@ -114,7 +114,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-
+
if (indexPath.row==0)
{
PieChartViewController *detailViewController = [[PieChartViewController alloc] init];
View
8 iOSPlot/iPhone/GenericViewController.m
@@ -45,7 +45,7 @@ - (id)init
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,150,30)];
[self.titleLabel setBackgroundColor:[UIColor clearColor]];
[self.titleLabel setTextColor:[UIColor whiteColor]];
- [self.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:20]];
+ [self.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:16]];
[self.navigationItem setTitleView:self.titleLabel];
[self.titleLabel release];
[self.titleLabel setTextAlignment:UITextAlignmentCenter];
@@ -53,7 +53,7 @@ - (id)init
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,60,40)];
[backButton setBackgroundImage:[UIImage imageNamed:@"back_button.png"] forState:UIControlStateNormal];
[backButton setTitle:@"Back" forState:UIControlStateNormal];
- [[backButton titleLabel] setFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:12]];
+ [[backButton titleLabel] setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:11]];
[backButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
UIBarButtonItem *backButtonitem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
[backButton release];
@@ -74,12 +74,12 @@ - (void)onBackButtonPressed:(id)sender
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
-*/
+ */
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
- [super viewDidLoad];
+ [super viewDidLoad];
}
*/
View
13 iOSPlot/iPhone/LineChartViewController.m
@@ -32,7 +32,7 @@
*/
#import "LineChartViewController.h"
-#import "SBJSON.h"
+#import "JSONKit.h"
@implementation LineChartViewController
@@ -46,15 +46,15 @@ - (id)init
lineChartView = [[PCLineChartView alloc] initWithFrame:CGRectMake(10,10,[self.view bounds].size.width-20,[self.view bounds].size.height-20)];
[lineChartView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
+ lineChartView.minValue = -40;
+ lineChartView.maxValue = 100;
[self.view addSubview:lineChartView];
[lineChartView release];
NSString *sampleFile = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"sample_linechart_data.json"];
NSString *jsonString = [NSString stringWithContentsOfFile:sampleFile encoding:NSUTF8StringEncoding error:nil];
-
- SBJSON *jsonParser = [SBJSON new];
- NSDictionary *sampleInfo = [jsonParser objectWithString:jsonString];
- [jsonParser release];
+
+ NSDictionary *sampleInfo = [jsonString objectFromJSONString];
NSMutableArray *components = [NSMutableArray array];
for (int i=0; i<[[sampleInfo objectForKey:@"data"] count]; i++)
@@ -63,7 +63,8 @@ - (id)init
PCLineChartViewComponent *component = [[PCLineChartViewComponent alloc] init];
[component setTitle:[point objectForKey:@"title"]];
[component setPoints:[point objectForKey:@"data"]];
-
+ [component setShouldLabelValues:NO];
+
if (i==0)
{
[component setColour:PCColorYellow];
View
6 iOSPlot/iPhone/PieChartViewController.m
@@ -50,13 +50,15 @@ - (id)init
PCPieChart *pieChart = [[PCPieChart alloc] initWithFrame:CGRectMake(([self.view bounds].size.width-width)/2,([self.view bounds].size.height-height)/2,width,height)];
[pieChart setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin];
[pieChart setDiameter:width/2];
+ [pieChart setSameColorLabel:YES];
+
[self.view addSubview:pieChart];
[pieChart release];
if ([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPad)
{
- pieChart.titleFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:30];
- pieChart.percentageFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:50];
+ pieChart.titleFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:30];
+ pieChart.percentageFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:50];
}
NSString *sampleFile = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"sample_piechart_data.plist"];
View
4 iOSPlot/iPhone/PieChartViewController2.m
@@ -57,8 +57,8 @@ - (id)init
if ([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPad)
{
- pieChart.titleFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:30];
- pieChart.percentageFont = [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:50];
+ pieChart.titleFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:30];
+ pieChart.percentageFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:50];
}
NSString *sampleFile = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"sample_piechart_data.plist"];
Please sign in to comment.
Something went wrong with that request. Please try again.