本文整理匯總了Java中org.achartengine.renderer.XYMultipleSeriesRenderer.addXTextLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java XYMultipleSeriesRenderer.addXTextLabel方法的具體用法?Java XYMultipleSeriesRenderer.addXTextLabel怎麽用?Java XYMultipleSeriesRenderer.addXTextLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.achartengine.renderer.XYMultipleSeriesRenderer
的用法示例。
在下文中一共展示了XYMultipleSeriesRenderer.addXTextLabel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "2007", "2008" };
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
11600, 13500 });
values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
12600, 14000 });
int[] colors = new int[] { Color.CYAN, Color.BLUE };
XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
renderer.setOrientation(Orientation.VERTICAL);
setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
renderer.setXLabels(1);
renderer.setYLabels(10);
renderer.addXTextLabel(1, "Jan");
renderer.addXTextLabel(3, "Mar");
renderer.addXTextLabel(5, "May");
renderer.addXTextLabel(7, "Jul");
renderer.addXTextLabel(10, "Oct");
renderer.addXTextLabel(12, "Dec");
int length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
seriesRenderer.setDisplayChartValues(true);
}
return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
Type.DEFAULT);
}
示例2: customizeMultipleRender
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
protected XYMultipleSeriesRenderer customizeMultipleRender(){
// Creating a XYMultipleSeriesRenderer to customize the whole chart
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setXLabels(0);
renderer.setBackgroundColor(Color.BLACK);
renderer.setAxesColor(Color.WHITE);
renderer.setGridColor(Color.WHITE);
renderer.setShowGrid(true);
renderer.setApplyBackgroundColor(true);
renderer.setXTitle("Month");
renderer.setYTitle("Avg. rebuffering ratio (%)");
// Changing font size and point size
renderer.setAxisTitleTextSize(26);
renderer.setLabelsTextSize(22);
renderer.setLegendTextSize(26);
renderer.setLegendHeight(80);
renderer.setPointSize(8);
// Setting margins: above, left, below, right
renderer.setMargins(new int[] {0, 70, 100, 50});
for(int i=0;i < xlabel.length;i++){
renderer.addXTextLabel(i+1, mMonth[i]);
}
return renderer;
}
示例3: execute
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 };
double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 };
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
RangeCategorySeries series = new RangeCategorySeries("Temperature");
int length = minValues.length;
for (int k = 0; k < length; k++) {
series.add(minValues[k], maxValues[k]);
}
dataset.addSeries(series.toXYSeries());
int[] colors = new int[] { Color.CYAN };
XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5,
-30, 45, Color.GRAY, Color.LTGRAY);
renderer.setBarSpacing(0.5);
renderer.setXLabels(0);
renderer.setYLabels(10);
renderer.addXTextLabel(1, "Jan");
renderer.addXTextLabel(3, "Mar");
renderer.addXTextLabel(5, "May");
renderer.addXTextLabel(7, "Jul");
renderer.addXTextLabel(10, "Oct");
renderer.addXTextLabel(12, "Dec");
renderer.addYTextLabel(-25, "Very cold");
renderer.addYTextLabel(-10, "Cold");
renderer.addYTextLabel(5, "OK");
renderer.addYTextLabel(20, "Nice");
renderer.setMargins(new int[] {30, 70, 10, 0});
renderer.setYLabelsAlign(Align.RIGHT);
XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(0);
r.setDisplayChartValues(true);
r.setChartValuesTextSize(12);
r.setChartValuesSpacing(3);
r.setGradientEnabled(true);
r.setGradientStart(-20, Color.BLUE);
r.setGradientStop(20, Color.GREEN);
return ChartFactory.getRangeBarChartIntent(context, dataset, renderer, Type.DEFAULT,
"Temperature range");
}
示例4: execute
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
public Intent execute(Context context){
readInfo(context);
XYMultipleSeriesRenderer multiRenderer = customizeMultipleRender();
Set<String> keyset = map.keySet();
String[] ISP = keyset.toArray(new String[keyset.size()]);
// Adding data
XYSeries[] SingleSeries = new XYSeries[ISP.length];
for(int i = 0; i< ISP.length; i++){
SingleSeries[i] = new XYSeries(ISP[i]);
}
for(int i = 0; i< ISP.length; i++){
ArrayList<String> data = map.get(ISP[i]);
Log.i("dataSize: ",Integer.toString(data.size()));
if(data.size()>xlabelCount) xlabelCount=data.size();
Log.i("xlabelCountT: ",Integer.toString(xlabelCount));
for(int j=0;j<data.size();j++){
String str=data.get(j);
String[] str_split=str.split("&");
String str_date=str_split[0];
String str_rb_ratio=str_split[1];
SingleSeries[i].add(j, Double.parseDouble(str_rb_ratio));
/**
* Add annotation for date
*/
SingleSeries[i].addAnnotation(str_date,j,Double.parseDouble(str_rb_ratio)+0.8);
}
}
/**
* Update x labels
*/
for(int i=0;i<xlabelCount;i++){
multiRenderer.addXTextLabel(i, Integer.toString(i+1));
}
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
for(int i = 0; i< ISP.length; i++){
// Creating a dataset for each series
dataset.addSeries(SingleSeries[i]);
// Building XYSeriesRenderer for each isp
XYSeriesRenderer renderer = buildXYSeriesRender(colorlist[i%colorlist.length], pointstylelist[i%pointstylelist.length]);
multiRenderer.addSeriesRenderer(renderer);
}
Intent intent = ChartFactory.getLineChartIntent(context, dataset, multiRenderer,
" Rebuffering ratio (%) per session");
return intent;
}