Skip to content

Commit

Permalink
More controller work
Browse files Browse the repository at this point in the history
  • Loading branch information
terryworona committed Jun 11, 2014
1 parent 447f7b1 commit 702b148
Showing 1 changed file with 72 additions and 3 deletions.
75 changes: 72 additions & 3 deletions anscombe-quartet-ios/Controllers/AQChartViewController.m
Expand Up @@ -11,6 +11,15 @@
// Views
#import <JBLineChartView.h>

// Enums
typedef NS_ENUM(NSInteger, AQChartScrollViewChartType){
AQChartScrollViewChartType1,
AQChartScrollViewChartType2,
AQChartScrollViewChartType3,
AQChartScrollViewChartType4,
AQChartScrollViewChartTypeCount
};

// Numerics
static const CGFloat kAQChartScrollViewHeight = 200.0f;
static const CGFloat kAQChartScrollViewPageControlHeight = 44.0f;
Expand All @@ -37,23 +46,59 @@ - (NSUInteger)numberOfChartsInChartScrollView:(AQChartScrollView *)chartScrollVi

@protocol AQScrollViewDelegate <NSObject>

- (UIView *)chartScrollView:(AQChartScrollView *)chartScrollView chartViewAtIndex:(NSUInteger)index;

@end

@interface AQChartViewController () <AQScrollViewDataSource, AQScrollViewDelegate>
@interface AQChartViewController () <AQScrollViewDataSource, AQScrollViewDelegate, JBLineChartViewDataSource, JBLineChartViewDelegate>

@property (nonatomic, strong) AQChartScrollView *scrollView;
@property (nonatomic, strong) NSArray *chartViews;
@property (nonatomic, strong) NSDictionary *dataModel;

- (void)initDataModel;

@end

@implementation AQChartViewController

#pragma mark - Alloc/Init

- (id)init
{
self = [super init];
if (self)
{
[self initDataModel];
}
return self;
}

#pragma mark - Data

- (void)initDataModel
{
NSMutableDictionary *mutableDataModel = [NSMutableDictionary dictionary];
self.dataModel = [NSMutableDictionary dictionaryWithDictionary:mutableDataModel];
}

#pragma mark - View Lifecycle

- (void)loadView
{
[super loadView];

NSMutableArray *mutableChartViews = [[NSMutableArray alloc] init];
for (int index=0; index < AQChartScrollViewChartTypeCount; index++)
{
JBLineChartView *lineChartView = [[JBLineChartView alloc] init];
lineChartView.tag = index;
lineChartView.delegate = self;
lineChartView.dataSource = self;
[mutableChartViews addObject:lineChartView];
}
self.chartViews = [NSArray arrayWithArray:mutableChartViews];

self.scrollView = [[AQChartScrollView alloc] initWithFrame:CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width, kAQChartScrollViewHeight)];
self.scrollView.dataSource = self;
self.scrollView.delegate = self;
Expand All @@ -65,7 +110,31 @@ - (void)loadView

- (NSUInteger)numberOfChartsInChartScrollView:(AQChartScrollView *)chartScrollView
{
return 4;
return AQChartScrollViewChartTypeCount;
}

- (UIView *)chartScrollView:(AQChartScrollView *)chartScrollView chartViewAtIndex:(NSUInteger)index
{
return nil;
}

#pragma mark - JBLineChartViewDataSource

- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView;
{
return 0;
}

- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex
{
return 0;
}

#pragma mark - JBLineChartViewDelegate

- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
{
return 0;
}

@end
Expand Down Expand Up @@ -93,4 +162,4 @@ - (void)reloadData

}

@end
@end

0 comments on commit 702b148

Please sign in to comment.