how to display a pie chart in blackberry applicati

2020-05-04 23:54发布

问题:

How to display a pie chart in blackberry application using rim apis? Are there controls available in the rim apis or how can it be done? Can some help me by sharing the code snippet

回答1:

The Google Chart API allows you to provide a URL to the Google service, which in turn returns a chart image. This capability is useful from the BlackBerry smartphone because data can be passed from the BlackBerry smartphone and generates a corresponding chart image on the BlackBerry smartphone.

here are the type of the chat you can do

Here are the chat types defined in Google API.

public static final String LINE_C = "lc";
public static final String LINE_S = "ls";
public static final String LINE_XY = "lxy";
public static final String BAR_HORIZONTAL_STACKED = "bhs";
public static final String BAR_VERTICAL_STACKED = "bvs";
public static final String BAR_HORIZONTAL_GROUPED = "bhg";
public static final String BAR_VERTICAL_GROUPED = "bvg";
public static final String BAR_ = "b";
public static final String PIE = "p";
public static final String PIE_3D = "p3";
public static final String PIE_CONCENTRIC = "pc";
public static final String VENN = "v";
public static final String SCATTER = "s";
public static final String RADAR = "r";
public static final String RADAR_SPLINES = "rs";
public static final String MAP = "t";
public static final String GOOGLE_O_METER = "gom";
public static final String QR_CODE = "qr";

The all you need to do is to request the chat URL. it will download as image to your device. The URL format is given below.

http://chart.apis.google.com/chart?&cht=p3&chd=t:250,100,40&chs=320x200&chl=Apple|Grapes|Mango

cht = chart type chd = chart data chs = chart size chl = chart label

Enjoy.