private void drawYAxisAndHorizontalLines(Graphics g, Font fontForAxisLabels) {
    Color oldColor = g.getColor();
    g.setColor(Color.BLACK);

    float ySize = getHeight() - getNumPixelsReservedOnBottom();

    if (selectedYAxis.isDisplayed())
      g.drawLine(
          selectedYAxis.getNumPixelsReserved(),
          0,
          selectedYAxis.getNumPixelsReserved(),
          (int) ySize);

    if (selectedYAxis.getNumberTicks() < 1) return;

    g.setFont(fontForAxisLabels);
    int leftBorder = getLeftBorder();

    if (selectedYAxis.isDisplayed()) {
      g.setColor(Color.RED);
      g.drawString(selectedYAxis.getAxisName(), selectedYAxis.numPixelsReserved, 10);
      g.setColor(Color.BLACK);
    }

    float yInterval = ySize / selectedYAxis.getNumberTicks();
    FontMetrics fm = g.getFontMetrics(fontForAxisLabels);
    int stringAscent = fm.getAscent();

    for (int x = 1; x < selectedYAxis.getNumberTicks(); x++) {
      int yVal = (int) (yInterval * x);
      g.setColor(Color.GRAY);

      g.drawLine(leftBorder, yVal, getWidth(), yVal);

      float axisValue =
          selectedYAxis.getHighVal()
              - (x / ((float) selectedYAxis.getNumberTicks()))
                  * (selectedYAxis.getHighVal() - selectedYAxis.getLowVal());
      String axisString = getYAxisTickLabel(axisValue);
      int tickLabelPos = selectedYAxis.getNumPixelsReserved() - fm.stringWidth(axisString) - 2;
      g.setColor(Color.BLACK);

      if (selectedYAxis.isDisplayed())
        g.drawString(axisString, tickLabelPos, yVal + stringAscent / 2);
    }
    g.setColor(oldColor);
  }