-
Notifications
You must be signed in to change notification settings - Fork 2
/
HighchartsObjCViewController.m
97 lines (75 loc) · 3.64 KB
/
HighchartsObjCViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// HighchartsObjCViewController.m
// HighchartsObjC
//
// Created by Tomasz Janeczko on 11-08-05.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "HighchartsObjCViewController.h"
#import "HighchartsHelper.h"
#import "HighchartsXYOptions.h"
#import "HighChartsPieOptions.h"
#import "ExamplePieSection.h"
#import "HighstockOptions.h"
#import "DatePoint.h"
@implementation HighchartsObjCViewController
@synthesize webView=_webView;
- (void)dealloc
{
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
//NSArray *xValues = [NSArray arrayWithObjects:[NSNumber numberWithFloat:3.0], [NSNumber numberWithFloat:4.0], [NSNumber numberWithFloat:5.0], nil];
//NSArray *yValues = [NSArray arrayWithObjects:[NSNumber numberWithFloat:6.0], [NSNumber numberWithFloat:-2.0], [NSNumber numberWithFloat:5.0], nil];
//HighchartsXYOptions *options = [[HighchartsXYOptions alloc] initWithTitle:@"ChartTitle" andXValues:xValues andYValues:yValues];
//options.yAxisTitle = @"My Title";
/*HighChartsPieOptions *options = [HighChartsPieOptions new];
options.chartTitle = @"My title";
ExamplePieSection *section1 = [ExamplePieSection pieSectionWithName:@"Car" andValue:[NSNumber numberWithInt:4] andColor:[UIColor redColor]];
ExamplePieSection *section2 = [ExamplePieSection pieSectionWithName:@"Credit Card" andValue:[NSNumber numberWithInt:1] andColor:[UIColor redColor]];
ExamplePieSection *section3 = [ExamplePieSection pieSectionWithName:@"Salary" andValue:[NSNumber numberWithInt:6] andColor:[UIColor greenColor]];
[options addObject: section1];
[options addObject: section2];
[options addObject: section3];*/
//[HighchartsHelper createLineChartInWebView:self.webView withOptions:options];
//[HighchartsHelper createPieChartInWebView:self.webView withOptions:options];
// [options release];
HighstockOptions *options = [HighstockOptions new];
options.title = @"Zomg!";
options.axisTitle = @"Income";
[options addDatePoint:[DatePoint datePointWithDate:[NSDate date] andValue:[NSNumber numberWithInteger:15]]];
[options addDatePoint:[DatePoint datePointWithDate:[NSDate dateWithTimeIntervalSinceNow:80000] andValue:[NSNumber numberWithInteger:12]]];
[options addDatePoint:[DatePoint datePointWithDate:[NSDate dateWithTimeIntervalSinceNow:160000] andValue:[NSNumber numberWithInteger:8]]];
[options addDatePoint:[DatePoint datePointWithDate:[NSDate dateWithTimeIntervalSinceNow:320000] andValue:[NSNumber numberWithInteger:0]]];
options.backgroundColor = [UIColor blueColor];
[HighchartsHelper createStockChartInWebView:self.webView withOptions:options];
[options release];
}
#pragma mark - View lifecycle
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
NSString* path = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end