Android - MPAndroidChart LineChart, not able to plot according to value date
<p>I am using MPAndroidChart for my line chart.
I have date values and score values.<br>
Example: on 11/10/2016 my score was 45.</p>

<p>I am struggling with the dates. Not sure how to set it in my setYAxisValues.<br>
I am getting my values from a rest api and putting it in the graph.</p>

<p>This part is where i have my problem. <br></p>

<pre><code>yVals.add(new Entry(Float.valueOf(ocd.getScore()), foo));
</code></pre>

<p>If I change foo to a normal int value like 1, 2, 3 I have no problem. The graph is working. The issue,  i need to use dates to plot my value at the correct place.</p>

<pre><code>@Override
protected void onPostExecute(List&lt;ResultModel&gt; result) {
    super.onPostExecute(result);
   //populating my yAxis with values from rest
    for (ResultModel ocd : resModelList){
        long unixSeconds = Long.parseLong(ocd.getPost_date());
        Date date = new Date(unixSeconds*1000L);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        String formattedDate = sdf.format(date);
        int foo = Integer.parseInt(formattedDate);
        yVals.add(new Entry(Float.valueOf(ocd.getScore()), foo));
    }
}
</code></pre>

<p>The X axis is working</p>

<pre><code>//set vales
private ArrayList&lt;String&gt; setXAxisValues(){
    xVals = new ArrayList&lt;String&gt;();
//MM/dd/yyyy
    xVals.add("01/01/2016");
    xVals.add("02/01/2016");
    xVals.add("03/01/2016");
    xVals.add("04/01/2016");
    xVals.add("05/01/2016");
    return xVals;
}

private ArrayList&lt;Entry&gt; setYAxisValues(){
    yVals = new ArrayList&lt;Entry&gt;();
    return yVals;
}
</code></pre>

<p>Thanks in advance</p>