How can I pass my value in url for a chart using google api?
Hello everyone I am new to iPhone app development. My application needs Piechart, so I use google chart api, I got this drawing. but it only shows up as static. how to give value in this url to create dynamic piechart.
How to pass the value for the chart in this below url.
NSString* myurl=@"http://chart.apis.google.com/chart?chf=bg,s,67676700&chs=300x225&cht=p&chd=s:Uf9a&chdl=30°|40°|50°|60°";
NSString *theurl=[myurl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
Below is my code:
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:theurl] cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLResponse* response;
NSError* error;
NSData *imageData=[NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
NSLog(@"%@",error);
NSLog(@"%@",response);
NSLog(@"%@",imageData);
UIImage *myimage = [[UIImage alloc] initWithData:imageData];
graphimage.image=myimage;
source to share
Hey you have to put your own input in url yourself, but you need to know the parameters and what it is used for. check this API doc for these options http://code.google.com/apis/chart/image/docs/making_charts.html
http://chart.apis.google.com/chart?chf=bg,s,67676700&chs=300x225&cht=p&chd=s:Uf9a&chdl=30 ° | 40 ° | 50 ° | 60 °
In this url change the chf chs value you want.
source to share