content: /*
   * Copyright (C) 2020 Adrian Miozga <AdrianMiozga@outlook.com>
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program. If not, see <https://www.gnu.org/licenses/>.
   */
  
  package org.wentura.getflow.statistics.historychart;
  
  import android.graphics.Canvas;
  
  import com.github.mikephil.charting.components.XAxis;
  import com.github.mikephil.charting.renderer.XAxisRenderer;
  import com.github.mikephil.charting.utils.MPPointF;
  import com.github.mikephil.charting.utils.Transformer;
  import com.github.mikephil.charting.utils.Utils;
  import com.github.mikephil.charting.utils.ViewPortHandler;
  
  final class CustomXAxisRenderer extends XAxisRenderer {
  
      CustomXAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer trans) {
          super(viewPortHandler, xAxis, trans);
      }
  
      @Override
      protected void drawLabel(Canvas c, String formattedLabel, float x, float y, MPPointF anchor, float angleDegrees) {
          String[] lines = formattedLabel.split("\n");
  
          for (int i = 0; i < lines.length; i++) {
              float vOffset = i * mAxisLabelPaint.getTextSize();
              Utils.drawXAxisValue(c, lines[i], x, y + vOffset, mAxisLabelPaint, anchor, angleDegrees);
          }
      }
  }