本文整理汇总了Java中org.achartengine.ChartFactory.getScatterChartIntent方法的典型用法代码示例。如果您正苦于以下问题:Java ChartFactory.getScatterChartIntent方法的具体用法?Java ChartFactory.getScatterChartIntent怎么用?Java ChartFactory.getScatterChartIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.ChartFactory
的用法示例。
在下文中一共展示了ChartFactory.getScatterChartIntent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onListItemClick
import org.achartengine.ChartFactory; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
switch (position) {
case 0:
Intent intent = ChartFactory.getLineChartIntent(this, getDemoDataset(), getDemoRenderer());
startActivity(intent);
break;
case 1:
intent = ChartFactory.getScatterChartIntent(this, getDemoDataset(), getDemoRenderer());
startActivity(intent);
break;
case 2:
intent = ChartFactory.getTimeChartIntent(this, getDateDemoDataset(), getDemoRenderer(), null);
startActivity(intent);
break;
case 3:
XYMultipleSeriesRenderer renderer = getBarDemoRenderer();
setChartSettings(renderer);
intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT);
startActivity(intent);
break;
}
}
示例2: execute
import org.achartengine.ChartFactory; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" };
List<double[]> x = new ArrayList<double[]>();
List<double[]> values = new ArrayList<double[]>();
int count = 20;
int length = titles.length;
Random r = new Random();
for (int i = 0; i < length; i++) {
double[] xValues = new double[count];
double[] yValues = new double[count];
for (int k = 0; k < count; k++) {
xValues[k] = k + r.nextInt() % 10;
yValues[k] = k * 2 + r.nextInt() % 10;
}
x.add(xValues);
values.add(yValues);
}
int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.MAGENTA, Color.LTGRAY, Color.GREEN };
PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.DIAMOND, PointStyle.TRIANGLE,
PointStyle.SQUARE, PointStyle.CIRCLE };
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
setChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.GRAY,
Color.LTGRAY);
renderer.setXLabels(10);
renderer.setYLabels(10);
length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true);
}
return ChartFactory.getScatterChartIntent(context, buildDataset(titles, x, values), renderer);
}