could you please suggest something!
the problem:
i am using achartengine library (achartengine) to draw a pie chart in my android app:
the problem - it works fine for emulator but doesn't work on real phones.
As i found out it (a real phone) thinks that the values are all zeros.
I logged the values in the application right before adding to the series and after as the series elements - they are not zeros.
i've done everything that should be done - exported library achartengine-1.1.0.jar and so on, it works fine apart from that
details:
i pass Integer arrayList to my class (that would be the data for the pie chart) then i convert it to double because add method accepts double values:
add
public void add(java.lang.String category,
double value)
Adds a new value to the series.
Parameters:
category - the category
value - the new value
that's my class that draw pie chart
public class piegraph {
public Intent getIntent(Context context, ArrayList<Integer> arraylist) {
double val1 = arraylist.get(0).doubleValue();
double val2 = arraylist.get(1).doubleValue();
double val3 = arraylist.get(2).doubleValue();
double val4 = arraylist.get(3).doubleValue();
double val5 = arraylist.get(4).doubleValue();
double val6 = arraylist.get(5).doubleValue();
CategorySeries series = new CategorySeries("Pie iGraph");
// the way it doesn't work on a phone:
series.add("6A", val1);
series.add("6B", val2);
series.add("6C", val3);
series.add("7A", val4);
series.add("7B", val5);
series.add("7C", val6);
// the way it works on a phone:
/*
series.add("6A", 2);
series.add("6B", 3);
series.add("6C", 4);
series.add("7A", 6);
series.add("7B", 3);
series.add("7C", 3); */
int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN, Color.LTGRAY };
DefaultRenderer renderer = new DefaultRenderer();
for (int color : colors) {
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(color);
renderer.addSeriesRenderer(r);
}
renderer.setChartTitle("This month");
renderer.setChartTitleTextSize(7);
renderer.setZoomButtonsVisible(true);
Intent intent = ChartFactory.getPieChartIntent(context, series, renderer, "Pie");
return intent;
}
}
and i call it and pass the array list like this:
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnGra:
ArrayList<Integer> arra = new ArrayList<Integer>();
arra.add(sum_6a);
arra.add(sum_6b);
arra.add(sum_6c);
arra.add(sum_7a);
arra.add(sum_7b);
arra.add(sum_7c);
piegraph pie = new piegraph();
Intent lineIntent = pie.getIntent(this, arra);
startActivity(lineIntent);
break;
}
}
so i don't really have an idea what could be wrong, tested on two phones, Android 2.3.6, Target version is 2.3.3
thanks!