0
votes

I'm trying to create an android activity with 2 MPAndroidChart LineCharts, however the entries in this 2 line charts may not be absolutely similar. I am creating and filling 2 datasets

LineDataSet one = null;
LineDataSet two = null;
ArrayList<Entry> oneList = new ArrayList<>();
ArrayList<Entry> twoList = new ArrayList<>();
//here I add entries to arraylists, the sizes may not be the same
List<ILineDataSet> dataSets = new ArrayList<>();
dataSets.add(one);
dataSets.add(two);
ArrayList<String> labelsIdeal = new ArrayList<>();
//here I add all the labels for both line charts

The result I want to have: The result I want to have

The result I am getting: The result I am getting

The labels are not paired with entries, and I can not find a solution, how to do it. Please, help!!!

1

1 Answers

0
votes

I have found what I've done wrong. When we add entries, the second parameter is xIndex, which is connected with the label on the chart, so after forming a list of all labels it is necessary to update xIndexes of entries, so the chart will be correct