I am totally new to HighCharts and I referred example http://blog.li-labs.com/developing-ios-apps-with-custom-charting/ and tried same, but on iPad simulator I am getting a blan
Useful code for calling .html in UIWebView.
-(void)viewDidLoad
{
NSString *pathOfFile = [[NSBundle mainBundle] pathForResource:@"chart" ofType:@"html"];
NSString *htmlText =[NSString stringWithContentsOfFile:pathOfFile encoding:NSUTF8StringEncoding error:nil];
NSURL *baseURL = [NSURL fileURLWithPath:pathOfFile];
[UIWebView loadHTMLString: htmlText baseURL:baseURL];
}
Steps:-
1) First just creat one html file and do the needful code or for trial can copy html code from examples that you get from package http://www.highcharts.com/download
2) Make sure that the scripts in html should have proper .js links
for e.g:- <script src="http://code.highcharts.com/highcharts.js"></script>
or
if you want to give it locally you can write <script src="highcharts.js"></script>
But make sure that the .js files are there in your application folder.
3) NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"graph" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[obj loadHTMLString:htmlString baseURL:nil]; // Webview *obj;
Hope this help you. In my case its working.
I tried the suggestions in this post and couldn't get the HighChart load.
The problem ended up being the "loadHTMLString" call. Passing nil for the baseURL was incorrect. Here's what worked for me - I needed to pass the actual baseURL:
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:url ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
NSURL *baseURL = [NSURL fileURLWithPath:htmlFile];
[webView loadHTMLString:htmlString baseURL:baseURL];