I have a collection named PuckData where I store some int values(temperature, light) and timestamp. I would like to display those values in line graphs with Android Graph Library(jjoe64). The first graph will be temperature(yAxis)-timestamp(xAxis) and the second will be light-timestamp. I want the timestamp values to be displayed in this format: dd:mm:yyyy. In the code below I receive the values of temperature and light. I want to get timestamp values also.
firebaseFirestore.collection("PuckData").whereEqualTo("region", "Bedroom")
.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
int light = document.getLong("light").intValue();
int temperature = document.getLong("temperature").intValue();
Log.d("PUCK", "LIGHT: " + light);
}
} else {
Log.d("PUCK", "Error getting documents: ", task.getException());
}
}
});
PuckData Collection Image How is it possible to add them in ArrayLists and pass them as Data points? Thanks in advance!