I'm a bit stuck here. I have a graph but next to the graph I would love to put a textview. The textView should get my records straight from the database and add a colour code to it. (For now a simple for loop will do)
I've got to the point that the pie chart gets drawn and a textview next to the pie chart shows all strings printed (which is now test + the number from the array)
protected void createPiechart(){
Number[] seriesOfNumbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int teller = 0, teller2 = 0;
String text= "";
PieGraph pg = (PieGraph) findViewById(R.id.piegraph);
for (teller = 0; teller < seriesOfNumbers.length;) {
//Random colors in the whole range
Random randomFullRange = new Random();
int color = Color.argb(255, randomFullRange.nextInt(256), randomFullRange.nextInt(256), randomFullRange.nextInt(256));
teller2 = 100 + (15 * teller);
seriesOfNumbers[teller] = teller;
PieSlice slice = new PieSlice();
//Random colors only in green tints.
//Random rnd = new Random();
//int color = Color.argb(255, 0, teller2, 0);
slice.setColor(color);
slice.setValue(teller);
slice.setTitle("test");
pg.addSlice(slice);
text += "test " + teller + "\n";
teller++;
}
TextView textPieGraph = (TextView) findViewById(R.id.textPieGraph);
textPieGraph.setText(text);
}
Now I would like to add the colour that the pieslice has in the textview in some sort of bitmap (lets say 20px*20px) Which would give Bitmap Categoryname1 Bitmap2 Categoryname2 ... etc etc.
Now how could I add bitmaps to it dynamically with the same colours of my int color value? I'd love a colour coded list with the text.
Thanks Yenthe