0
I have the following code:
public class Pontuacaouseractivity extends Appcompatactivity {
PieChart graficoUser;
int pontosCor, pontosNumero, pontosObjeto;
FirebaseUser user;
FirebaseAuth auth;
DatabaseReference databaseRef, userDB;
ArrayList<PieEntry> entries;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Firebase.setAndroidContext(this);
setContentView(R.layout.activity_pontuacao_user);
auth = FirebaseAuth.getInstance();
databaseRef = FirebaseDatabase.getInstance().getReference();
user = auth.getCurrentUser();
userDB = databaseRef.child(user.getUid());
graficoUser = (PieChart) findViewById(R.id.graficoUser);
userDB.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Map<String, String> map = (Map<String, String>) dataSnapshot.getValue();
Log.v("map", map+"");
String username = map.get("username");
String password = map.get("password");
String email = map.get("email");
String pontuacaoObjeto = map.get("pontuacaoObjeto");
String pontuacaoCor = map.get("pontuacaoCor");
String pontuacaoNumero = map.get("pontuacaoNumero");
pontosObjeto = Integer.valueOf(pontuacaoObjeto);
pontosNumero = Integer.valueOf(pontuacaoNumero);
pontosCor = Integer.valueOf(pontuacaoCor);
Log.v("nome: ",email+"");
entries = new ArrayList<>();
entries.add(new PieEntry(pontosCor, "cor"));
entries.add(new PieEntry(pontosNumero, "numero"));
entries.add(new PieEntry(pontosObjeto, "objeto"));
PieDataSet dataset = new PieDataSet(entries, "pontuações");
ArrayList<String> labels = new ArrayList<String>();
labels.add("pontuação da cor");
labels.add("pontuação do numero");
labels.add("pontuação do objeto");
dataset.setLabel(labels.toString());
PieData data = new PieData(dataset);
PieChart chart = new PieChart(getApplicationContext());
setContentView(chart);
chart.setData(data);
chart.setContentDescription("pontuações");
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
I’m not finding good tutorials on the internet that can help me change the color of entries and Abels. Help please?
this is the current effect:
opa! worked :D but as I change the color of Abels?
– Mikhael Araujo
Type here: Entries = new Arraylist<>(); Entries.add(new Pieentry(pointsCor, "color")); Entries.add(new Pieentry(pointsNumero, "number"); Entries.add(new Pieentry(pointsObject, "object")); the displayed text of each label, just below the value, is white. wanted to change it as well as the size. have idea?
– Mikhael Araujo
I found out already, looking at the code of your project! huauha. mt obg !!!
– Mikhael Araujo