Permalink
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...
grgcombs committed May 3, 2011
1 parent d6c3f1d commit 87fe22898af7ca0a40e7139f6058ab09801c70ac
View
@@ -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
Binary file not shown.
Submodule JSONKit added at b8359c

Large diffs are not rendered by default.

Oops, something went wrong.
Submodule SBJSON deleted from 2cfbb4
@@ -9,7 +9,7 @@
69,
70
],
- "title": "AAA"
+ "title": "Smith"
},
{
"data": [
@@ -20,27 +20,27 @@
22,
30
],
- "title": "BBB"
+ "title": "Repub"
},
{
"data": [
40,
55,
56,
66,
- 70,
- 70
+ 40,
+ -30
],
- "title": "CCC"
+ "title": "Dem"
},
{
"data": [
null,
89,
90,
85,
- 90,
- 95
+ 60,
+ -15
],
"title": "DDD"
},
@@ -51,7 +51,7 @@
55,
33,
50,
- 46
+ -6
],
"title": "EEE"
}
@@ -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
Oops, something went wrong.

0 comments on commit 87fe228

Please sign in to comment.