private void prepareForPaint() {

    // set the axis data types, making sure all are compatible
    xAxis.setAxisDataType(null);
    yAxis.setAxisDataType(null);
    for (Series_AxesChart series : chart.getSeriesMap().values()) {
      xAxis.setAxisDataType(series.getxAxisDataType());
      yAxis.setAxisDataType(series.getyAxisDataType());
    }

    // calculate axis min and max
    xAxis.resetMinMax();
    yAxis.resetMinMax();

    // if no series, we still want to plot an empty plot with axes. Since there are no min and max with no series added, we just fake it arbitrarily.
    if (chart.getSeriesMap() == null || chart.getSeriesMap().size() < 1) {
      xAxis.addMinMax(-1, 1);
      yAxis.addMinMax(-1, 1);
    }
    else {
      for (Series_AxesChart series : chart.getSeriesMap().values()) {
        // add min/max to axes
        // System.out.println(series.getxMin());
        // System.out.println(series.getxMax());
        // System.out.println(series.getyMin());
        // System.out.println(series.getyMax());
        // System.out.println("****");
        xAxis.addMinMax(series.getXMin(), series.getXMax());
        yAxis.addMinMax(series.getYMin(), series.getYMax());
      }
    }

    overrideMinMax();

    // logarithmic sanity check
    if (chart.getStyler().isXAxisLogarithmic() && xAxis.getMin() <= 0.0) {
      throw new IllegalArgumentException("Series data (accounting for error bars too) cannot be less or equal to zero for a logarithmic X-Axis!!!");
    }
    if (chart.getStyler().isYAxisLogarithmic() && yAxis.getMin() <= 0.0) {
      // System.out.println(getMin());
      throw new IllegalArgumentException("Series data (accounting for error bars too) cannot be less or equal to zero for a logarithmic Y-Axis!!!");
    }
  }