title: Android: How to neatly format date/time on x-axis using MPAndroidChart?
body: <p>I'm using the MP Android Chart library to plot data, on the x-axis I have Unix timestamps. Even thought the data itself is rounded up to the nearest day or hour (depending on the data range), my x-axis is all broken down to minutes. It shows values like '22.07 19:37'. Too bad MpAndroidChart doesn't take care of pretty dates.</p>
  
  <p>What I would like the x-axis to do:</p>
  
  <ul>
  <li>at 1st of month in case of year span;</li>
  <li>at start of day in case of month or week span;</li>
  <li>on any full hour (##:00) (not perse all) in case of a day span;</li>
  <li>on any 5 minute point on an hour span.</li>
  </ul>
  
  <p>(These requirements were copied from <a href="https://stackoverflow.com/questions/40803233/mpandroidchart-x-axis-date-time-label-formatting">this question</a> never solved.)</p>
  
  <p>This is what I have so far:</p>
  
  <p><strong>onCreate (or whatever):</strong></p>
  
  <pre><code>LineDataSet dataSet = new LineDataSet(entries, "label x"); // add entries to dataset
  LineData lineData = new LineData(dataSet);
  chart.setData(lineData);
  
  XAxis xAxis = chart.getXAxis();
  xAxis.setValueFormatter(new DateAxisFormatter(chart));
  
  chart.invalidate(); // refresh
  </code></pre>
  
  <p><strong>DateAxisFormatter class</strong>:</p>
  
  <pre><code>public class DateAxisFormatter implements IAxisValueFormatter {
  
      private Chart chart;
  
      public  DateAxisFormatter( Chart chart ) {
  
          this.chart = chart;
      }
  
      @Override
      public String getFormattedValue(float value, AxisBase axis) {
  
          String result = "";
          Date date = new Date((long) value);
          SimpleDateFormat prettyFormat = new SimpleDateFormat("dd.MM H:mm");
          prettyFormat.setTimeZone(TimeZone.getDefault());
          result = prettyFormat.format(date);
  
          return result;
      }
  }
  </code></pre>
  
  <p>How do I go about making pretty dates with this?</p>