I made an Android application that gets the data from Firebase which I managed to do, I made the linedataset but my xAxis should be Strings (dates), my yAxis is float. I managed to do the yAxis and the xAxis (but it only shows the days, and I want it to show the whole date). This is my code so far:
for (DataSnapshot snapshot1 : snapshot.getChildren()){
String data = snapshot1.getKey(); //This is the date that I want to show
String[] values = data.split("-");
int day = Integer.parseInt(values[2]);
int month = Integer.parseInt(values[1]);
int year = Integer.parseInt(values[0]);
int int1 = (int) (snapshot1.getChildrenCount() - 1);
arraylist.add(new Entry(day, int1));
}
LineDataSet lineDataSet = new LineDataSet(arraylist, "something");
ArrayList<ILineDataSet> iLineDataSets = new ArrayList<>();
iLineDataSets.add(lineDataSet);
LineData lineData = new LineData(iLineDataSets);
lineChart.setData(lineData);
lineChart.invalidate();
EDIT: I made some research and now I know that I should use lineChart.getXAxis().setValueFormatter(new IndexAxisValueFormatter(dates)); But this shows nothing, dates is an arraylist and there are three values in it. I am sure of it because if I toast the values it shows the three values.