Package de.intranda.commons.chart.results

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


     } else {
       title.append(", " + stepname + " )");
     }

    // building table for the Table
    DataTable dtbl = new DataTable(title.toString());
    // building a second table for the chart
    DataTable dtblChart = new DataTable(title.toString());
    //
    DataRow dataRowChart;
    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) {
      dataRowChart = new DataRow(null);
      dataRow = new DataRow(null);
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        // String identifier = timeGrouping.getTitle();
        // setting row name with localized time group and the date/time extraction based on the group

        dataRowChart.setName(new Converter(objArr[2]).getString() + "");
        dataRow.setName(new Converter(objArr[2]).getString() + "");
        // dataRow.setName(new Converter(objArr[2]).getString());

        // building up row depending on requested output having different fields
        switch (this.cu) {

        case volumesAndPages: {
          dataRowChart.addValue(CalculationUnit.volumes.getTitle(), (new Converter(objArr[0]).getDouble()));
          dataRowChart.addValue(CalculationUnit.pages.getTitle() + " (*100)", (new Converter(objArr[1]).getDouble()) / 100);

          dataRow.addValue(CalculationUnit.volumes.getTitle(), (new Converter(objArr[0]).getDouble()));
          dataRow.addValue(CalculationUnit.pages.getTitle(), (new Converter(objArr[1]).getDouble()));

        }
          break;

        case volumes: {
          dataRowChart.addValue(CalculationUnit.volumes.getTitle(), (new Converter(objArr[0]).getDouble()));
          dataRow.addValue(CalculationUnit.volumes.getTitle(), (new Converter(objArr[0]).getDouble()));

        }
          break;

        case pages: {

          dataRowChart.addValue(CalculationUnit.pages.getTitle(), (new Converter(objArr[1]).getDouble()));
          dataRow.addValue(CalculationUnit.pages.getTitle(), (new Converter(objArr[1]).getDouble()));

        }
          break;

        }

        // fall back, if conversion triggers an exception
      } catch (Exception e) {
        dataRowChart.addValue(e.getMessage(), new Double(0));
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      // finally adding dataRow to DataTable and fetching next row
      // adding the extra table
      dtblChart.addDataRow(dataRowChart);
      dtbl.addDataRow(dataRow);
    }

    // a list of DataTables is expected as return Object, even if there is only one
    // Data Table as it is here in this implementation
    dtblChart.setUnitLabel(Helper.getTranslation(this.timeGrouping.getSingularTitle()));
    dtbl.setUnitLabel(Helper.getTranslation(this.timeGrouping.getSingularTitle()));

    dtblChart.setShowableInTable(false);
    dtbl.setShowableInChart(false);

    allTables.add(dtblChart);
    allTables.add(dtbl);
    return allTables;
View Full Code Here


    IDataSource testFilter = new UserDefinedFilter("stepdone:5");
    test.setTimeUnit(TimeUnit.days);
    List<DataTable> tables = test.getDataTables(testFilter);
    int countTableInTables = 0;
    while (countTableInTables < tables.size()) {
      DataTable table = tables.get(countTableInTables);
      int countRowsInTable = 0;
      while (countRowsInTable < table.getDataRowsSize()) {
        List<DataRow> rows = table.getDataRows();
        ListIterator<DataRow> countRowInRows = rows.listIterator();
        while (countRowInRows.hasNext()) {
          DataRow row = countRowInRows.next();
          int number = row.getNumberValues();
          int countValuesInRow = 0;
View Full Code Here

    IDataSource testFilter = new UserDefinedFilter("stepdone:5");
    test.setTimeUnit(TimeUnit.days);
    List<DataTable> tables = test.getDataTables(testFilter);
    java.util.Iterator<DataTable> tablesIterator = tables.iterator();
    int counter = 0;
    DataTable table = null;
    DataRow row = null;
    while (tablesIterator.hasNext()){
      table = tablesIterator.next();
      List<DataRow> rows = table.getDataRows();
      java.util.Iterator<DataRow> rowsIterator = rows.iterator();
      while (rowsIterator.hasNext()){
        row = rowsIterator.next();
      counter += row.getMaxValue();
      }
View Full Code Here

TOP

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

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.