-2
我正在使用aChartEngine處理圖表圖表,問題是雖然圖表正在生成,問題是圖形不會按照需要在視圖內部傳入,如何解決?Android中的aChartEngine中的條形圖
當選擇從落井棒向下
縮小後和平移(通過與圖形交互)
這是我的代碼
private static XYMultipleSeriesDataset getBarDataset(int rightAnswers, int wrongAnswers)
{
String[] labels={"right","wrong"};
List<Double> values = new ArrayList<Double>();
values.add((double) rightAnswers);
values.add((double) wrongAnswers);
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
for (int i = 0; i < titles.length; i++)
{
XYSeries series = new XYSeries(titles[i]);
series.add(i,values.get(i));
dataset.addSeries(i,series);
}
return dataset;
}
2)渲染
protected static XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.addXTextLabel(0, "right");
renderer.addXTextLabel(1, "wrong");
renderer.setChartTitle("Results");
int length = colors.length;
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(colors[0]);
renderer.addSeriesRenderer(r);
r = new SimpleSeriesRenderer();
r.setColor(colors[1]);
renderer.addSeriesRenderer(r);
renderer.setScale(10);
renderer.setXLabels(0);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.WHITE);
renderer.setAxesColor(Color.CYAN);
renderer.setBarWidth(30);
return renderer;
}
3)視圖
ChartFactory.getBarChartView(context, getBarDataset(rightAnswers, wrongAnswers), buildBarRenderer(new int[]{Color.GREEN,Color.RED}), Type.DEFAULT);
查詢
1)如何修正的位置和精確的平移曲線圖
2),我們可以對棒??如何3d效果?
3)有沒有其他庫比aChartEngine更簡單?
你可以試試自己的帆布或瀏覽.. –
我加入視圖在對話框的FrameLayout –