Package de.intranda.commons.chart.results

Examples of de.intranda.commons.chart.results.DataRow


    DataTable dtbl = new DataTable(StatisticsMode.getByClassName(
        this.getClass()).getTitle() + " "
        + Helper.getTranslation("_inGB"));

    DataRow dataRow;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out
    for (Object obj : list) {
      dataRow = new DataRow(null);
      //TODO: Don't use arrays
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        //setting row name with date/time extraction based on the group

        dataRow.setName(new Converter(objArr[1]).getString() + "");

        dataRow.addValue(Helper.getTranslation("storageDifference"),
            (new Converter(objArr[0]).getGB()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      //finally adding dataRow to DataTable and fetching next row
      dtbl.addDataRow(dataRow);
    }
View Full Code Here


  /*
   * generate requiredOutputLine
   */
  private DataRow requiredOutput() {
    DataRow dataRow = new DataRow(Helper.getTranslation("requiredOutput"));
    dataRow.setShowPoint(false);

    Double requiredOutputPerTimeUnit = this.requiredDailyOutput * this.timeGrouping.getDayFactor();

    // assembling a requiredOutputRow from the labels in the reference row
    // and the calculated requiredOutputPerTimeUnit
    for (String title : this.timeGrouping.getDateRow(this.timeFilterFrom, this.timeFilterTo)) {
      dataRow.addValue(title, requiredOutputPerTimeUnit);
    }
    return dataRow;

  }
View Full Code Here

  /*
   * generate referenceCurve
   */
  private DataRow referenceCurve(DataRow referenceRow) {
    DataRow orientationRow = requiredOutput();
    DataRow dataRow = new DataRow(Helper.getTranslation("ReferenceCurve"));
    dataRow.setShowPoint(false);
    // may have to be calculated differently

    Integer count = orientationRow.getNumberValues();

    Double remainingOutput = this.requiredDailyOutput * this.timeGrouping.getDayFactor() * count;
    Double remainingAverageOutput = remainingOutput / count;

 

    // the way this is calculated is by subtracting each value from the
    // total remaining output
    // and calculating the averageOutput based on the remaining output and
    // the remaining periods
    for (int i = 0; i < orientationRow.getNumberValues(); i++) {
      dataRow.addValue(orientationRow.getLabel(i), remainingAverageOutput);
      Double doneValue = referenceRow.getValue(orientationRow.getLabel(i));
      if (doneValue != null) {
        remainingOutput = remainingOutput - doneValue;
      }
      count--;
View Full Code Here

  public DataRow getDataRow(String stepName) {
    Boolean flagNoContent = true;
    for (int i = 0; i < getDataTable().getDataRows().size(); i++) {
      flagNoContent = false;
      DataRow dr = getDataTable().getDataRows().get(i);
      if (dr.getName().equals(stepName)) {
        return dr;
      }
    }
    // TODO: Retireve from Messages
    String message = "couldn't retrieve requested DataRow by name '" + stepName + "'";
View Full Code Here

    if (this.commonWorkFlow == null) {
      return null;
    }

    DataRow headerRow = new DataRow("Header - delete again");

    for (StepInformation step : this.commonWorkFlow) {
      String stepName = step.getTitle();
      headerRow.setName("header - delete again");
      headerRow.addValue(stepName, Double.parseDouble("0"));
    }

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("stepCount", StandardBasicTypes.DOUBLE);
    query.addScalar("stepName", StandardBasicTypes.STRING);
    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable("");

    // if headerRow is set then add it to the DataTable to set columns
    // needs to be removed later
    if (headerRow != null) {
      dtbl.addDataRow(headerRow);
    }

    DataRow dataRow = null;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out

    // checks if intervall has changed which then triggers the start for a
    // new row
    // intervall here is the timeGroup Expression (e.g. "2006/05" or
    // "2006-10-05")
    String observeIntervall = "";

    for (Object obj : list) {
      Object[] objArr = (Object[]) obj;
      String stepName = new Converter(objArr[1]).getString();
      if (isInWorkFlow(stepName)) {
        try {
          String intervall = new Converter(objArr[2]).getString();

          if (!observeIntervall.equals(intervall)) {
            observeIntervall = intervall;

            // row cannot be added before it is filled because the
            // add process triggers
            // a testing for header alignement -- this is where we
            // add it after iterating it first
            if (dataRow != null) {
              dtbl.addDataRow(dataRow);
            }

            // setting row name with localized time group and the
            // date/time extraction based on the group
            dataRow = new DataRow(intervall);
          }
          Double count = new Converter(objArr[0]).getDouble();
          dataRow.addValue(stepName, count);

        } catch (Exception e) {
          dataRow.addValue(e.getMessage(), new Double(0));
        }
      }
    }
    // to add also the last row
    if (dataRow != null) {
View Full Code Here

    }
    StringBuilder title = new StringBuilder(StatisticsMode.getByClassName(this.getClass()).getTitle());

    DataTable dtbl = new DataTable(title.toString());
    dtbl.setShowableInPieChart(true);
    DataRow dRow = new DataRow(Helper.getTranslation("count"));

    for (Object obj : crit.list()) {
      Schritt step = (Schritt) obj;
      String kurztitel = (step.getTitel().length() > 60 ? step.getTitel().substring(0, 60) + "..." : step.getTitel());
      dRow.addValue(kurztitel, dRow.getValue(kurztitel) + 1);
    }

    dtbl.addDataRow(dRow);
    List<DataTable> allTables = new ArrayList<DataTable>();
View Full Code Here

    DataTable dtbl = new DataTable(StatisticsMode.getByClassName(
        this.getClass()).getTitle()
        + Helper.getTranslation("_(number)"));

    DataRow dataRow;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out
    for (Object obj : list) {
      dataRow = new DataRow(null);
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        //setting row name with date/time extraction based on the group

        dataRow.setName(new Converter(objArr[1]).getString() + "");

        dataRow.addValue(Helper.getTranslation("Corrections/Errors"),
            (new Converter(objArr[0]).getDouble()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      //finally adding dataRow to DataTable and fetching next row
      dtbl.addDataRow(dataRow);
    }
View Full Code Here

    StringBuilder title = new StringBuilder(StatisticsMode.getByClassName(
        this.getClass()).getTitle());

    DataTable dtbl = new DataTable(title.toString());
    dtbl.setShowableInPieChart(true);
    DataRow dRow = new DataRow(Helper.getTranslation("count"));

    for (Object obj : crit.list()) {
      Object[] objArr = (Object[]) obj;
      dRow.addValue(new Converter(objArr[1]).getString(), new Converter(
          new Converter(objArr[0]).getInteger()).getDouble());
    }
    dtbl.addDataRow(dRow);

    List<DataTable> allTables = new ArrayList<DataTable>();
View Full Code Here

     
      tableStepDone.setShowableInTable(true);

      // to merge we just take each table and dump the entire content in a
      // row for the open step
      DataRow rowOpenSteps = new DataRow(Helper.getTranslation("openSteps") + " " + i.toString());
      for (DataRow dtr : tableStepOpen.getDataRows()) {
        rowOpenSteps.addValue(dtr.getName(), dtr.getValue(0));
      }

      // adding the first row
      String title = "";
      if (tableStepOpen.getName().length() > 0) {
        title = tableStepOpen.getName();
      } else {
        title = tableStepDone.getName();
      }

      tableStepOpenAndDone = new DataTable(Helper.getTranslation("throughput") + " " + Helper.getTranslation("steps") + " " + title);
      tableStepOpenAndDone.addDataRow(rowOpenSteps);

      // row for the done step
      rowOpenSteps = new DataRow(Helper.getTranslation("doneSteps") + " " + i.toString());
      for (DataRow dtr : tableStepDone.getDataRows()) {
        rowOpenSteps.addValue(dtr.getName(), dtr.getValue(0));
      }

      // adding that row
      tableStepOpenAndDone.addDataRow(rowOpenSteps);
View Full Code Here

  // TODO Remove redundant code
  private DataTable buildDataTableFromSQL(String natSQL, String headerFromSQL) {
    Session session = Helper.getHibernateSession();

    // creating header row from headerSQL (gets all columns in one row
    DataRow headerRow = null;
    if (headerFromSQL != null) {
      headerRow = new DataRow(null);
      SQLQuery headerQuery = session.createSQLQuery(headerFromSQL);

      // needs to be there otherwise an exception is thrown
      headerQuery.addScalar("stepCount", StandardBasicTypes.DOUBLE);
      headerQuery.addScalar("stepName", StandardBasicTypes.STRING);
      headerQuery.addScalar("stepOrder", StandardBasicTypes.DOUBLE);
      headerQuery.addScalar("intervall", StandardBasicTypes.STRING);

      @SuppressWarnings("rawtypes")
      List headerList = headerQuery.list();
      for (Object obj : headerList) {
        Object[] objArr = (Object[]) obj;
        try {
          headerRow.setName(new Converter(objArr[3]).getString() + "");
          headerRow.addValue(new Converter(new Converter(objArr[2]).getInteger()).getString() + " (" + new Converter(objArr[1]).getString()
              + ")", (new Converter(objArr[0]).getDouble()));

        } catch (Exception e) {
          headerRow.addValue(e.getMessage(), new Double(0));
        }
      }

    }

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("stepCount", StandardBasicTypes.DOUBLE);
    query.addScalar("stepName", StandardBasicTypes.STRING);
    query.addScalar("stepOrder", StandardBasicTypes.DOUBLE);
    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable("");

    // if headerRow is set then add it to the DataTable to set columns
    // needs to be removed later
    if (headerRow != null) {
      dtbl.addDataRow(headerRow);
    }

    DataRow dataRow = null;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out

    // checks if intervall has changed which then triggers the start for a
    // new row
    // intervall here is the timeGroup Expression (e.g. "2006/05" or
    // "2006-10-05")
    String observeIntervall = "";

    for (Object obj : list) {
      Object[] objArr = (Object[]) obj;
      try {
        // objArr[3]
        if (!observeIntervall.equals(new Converter(objArr[3]).getString())) {
          observeIntervall = new Converter(objArr[3]).getString();

          // row cannot be added before it is filled because the add
          // process triggers
          // a testing for header alignement -- this is where we add
          // it after iterating it first
          if (dataRow != null) {
            dtbl.addDataRow(dataRow);
          }

          dataRow = new DataRow(null);
          // setting row name with localized time group and the
          // date/time extraction based on the group
          dataRow.setName(new Converter(objArr[3]).getString() + "");
        }
        dataRow.addValue(
            new Converter(new Converter(objArr[2]).getInteger()).getString() + " (" + new Converter(objArr[1]).getString() + ")",
            (new Converter(objArr[0]).getDouble()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }
    }
    // to add the last row
    if (dataRow != null) {
      dtbl.addDataRow(dataRow);
View Full Code Here

TOP

Related Classes of de.intranda.commons.chart.results.DataRow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.