title: MPAndroidChart - How can I best set the X-axis values as strings/dates?
body: <p>I'm just a bit lost with this <a href="https://github.com/PhilJay/MPAndroidChart" rel="nofollow noreferrer">MPAndroid chart library</a>. </p>
  
  <p>I began the beginner example <a href="https://github.com/PhilJay/MPAndroidChart/wiki/Getting-Started" rel="nofollow noreferrer">here</a>, which recommends creating an array/list of objects with getValueX() and getValueY() methods, which you would then add as entries, like this:</p>
  
  <pre><code>List&lt;Entry&gt; entries = new ArrayList&lt;Entry&gt;(); // entry list    
  
  for(ValueAndDateObject data : valueAndDateArrayList){ 
  
      // valueAndDateArrayList is the list of my own data 
      //(objects with a String X-value, and a double Y-value)
  
      entries.add(new Entry(data.getValueX(), data.getValueY())); //error here
   }
  </code></pre>
  
  <p>There's an error there because Entry only takes (float x, float y). Obviously I can cast the double as a float, but I need the x-axis to have dates not floats. So I did some more searching and found a lot of Github issues about it, but the solutions there I can't seem to understand. Most point to something like <a href="https://github.com/PhilJay/MPAndroidChart/wiki/The-AxisValueFormatter-interface" rel="nofollow noreferrer">this in the docs</a>. The problem I'm having is I don't understand how this gets applied to the Entry(float x, float y) issue. I can't find when/where the docs/solutions say to apply to Entry(). </p>
  
  <p>So when I look at the example about creating the formatter and then setting it, I don't get where the entries.add(new Entry()) stuff comes in. Does that technique replace it? Do I somehow pass it in?</p>
  
  <p>For reference, here's my full method, designed after the beginner example mentioned previously. </p>
  
  <pre><code>public void updateUI(final ArrayList&lt;ValueAndDateObject&gt; valueAndDateArrayList){
      List&lt;Entry&gt; entries = new ArrayList&lt;Entry&gt;();
  
  
  
      for(ValueAndDateObject data : valueAndDateArrayList){
  
      /** for the sake of the example, let's say there's only one 
      *   ValueAndDataObject in the list and getValueX() returns "02-27-2016"
      *   and getValueY() returns 12,345.0
      */
  
          entries.add(new Entry(data.getValueX(), data.getValueY())); //error obviously 
      }        
  
      // would I add the formatter somewhere in here? And what would I "add" it to?
  
      LineDataSet dataSet = new LineDataSet(entries, "Label");
      dataSet.setColor(Color.YELLOW);
      dataSet.setValueTextColor(Color.BLACK);
  
      LineData lineData = new LineData(dataSet);
      lineChart.setData(lineData);
      lineChart.invalidate();
  }
  </code></pre>
  
  <p>From what I can tell, I'll have to make my own formatter class, which I'll model off of the string[] example in the formatter doc link. My hang up is on the "Setting the formatter" section. Just not sure about how that will change/interact with the Entry(float x, float y) issue. </p>