Ejemplo n.º 1
0
  @Override
  protected void initPosition() {
    super.initPosition();
    screen_height = getMeasuredHeight();
    screen_width = getMeasuredWidth();
    int count = dataList.size();

    double sum = 0;
    double withdrawal = 0;
    double min = Integer.MAX_VALUE;
    double max = -Integer.MAX_VALUE;
    for (int i = 0; i < count; i++) {
      withdrawal = dataList.get(i).getWithdrawals();
      sum += withdrawal;
      if (withdrawal > max) {
        max = withdrawal;
      }
      if (withdrawal < min) {
        min = withdrawal;
      }
    }
    averageWithdrawal = (int) sum / count;

    averageText =
        "Average Expenditure on Card: " + Utils.generateFormatMoney(dollar, averageWithdrawal);

    xPaintScale = (int) (screen_height * x_paint_scale);
    yPaintScale = (int) (screen_height * y_paint_scale);

    detailText1Size = (int) (detail_text_1_size * screen_height);
    detailText2Size = (int) (detail_text_2_size * screen_height);
    titleSecondSize = (int) (title_second_size * screen_height);
    titleSecondY = titleLineY + (int) (titleSecondSize * 1.2F);

    yAxisStartYPosition = titleSecondY + padding;
    yAxisEndYPosition = screen_height - padding - 2 * yPaintScale;

    initYValues(max, min);

    yAxisXPosition = getMaxYValueLen() + padding;

    xAxisStartXPosition = yAxisXPosition;
    xAxisEndXPosition = screen_width - padding;

    xCellLength = (int) ((float) (xAxisEndXPosition - xAxisStartXPosition) / (count + 1));

    detailRoundR = (int) (detail_round_r * screen_height);

    generateBarList();
  }