Hello Everyone, here I’ll be blogging about using Google Image
Charts in Android phone. Let’s get acquainted with Google Image
Charts. The Google Chart API lets you dynamically generate
charts with a URL string. You can embed these charts on your
WebView or download the image for local or offline use. It
returns a PNG image of a chart in response to a URL GET or
POST request.There are a lot of types of charts and you can
specify its size,colors,labels and other properties. Let’s
create a simple chart.
1.Decide on a chart type.
Chart type is specified by the "cht" parameter.
2.Choose a data format and decide whether your data must be
scaled to fit your chart.
Data is specified using the "chd" parameter
3.Specify the chart size.
Chart size is specified using the "chs" parameter.
4.Add additional parameters.
You can find some of possible parameters below.
chxr - specifies the range of values that appear on
each axis independently
chds - specifies parameters to scale the numeric
value displayed
chg - specifies solid or dotted grid lines
chco - specifies the colors of a specific series
chf - specifies fill colors and styles for the
chart data are and/or the whole chart
background
chxl - specifies string axis labels on any axis
chm – specfies graphical markers for data points
on a chart
5.Build your URL String.
The URL start with http://chart.apis.google.com/chart?
and is followed by all required and optional parameters.
6.Use GET or POST to get image.
URL-s are limited to 2k in length, so if you have
more data you should consider using POST.
Monday, April 19, 2010
Graphing Challenges for Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment