Package com.googlecode.gwt.charts.client

Examples of com.googlecode.gwt.charts.client.DataTable


    for (CommunityAccount commAcc: listAccount) {
      listStats.add(commAcc.getName());
     
    }
    // Prepare the data
    DataTable dataTable = DataTable.create();
    dataTable.addColumn(ColumnType.STRING, "dates");
   
//    for (int i = 0; i < countries.length; i++) {
//      dataTable.addColumn(ColumnType.NUMBER, countries[i]);
//    }
    //
    for (String nameStat: listStats) {
      dataTable.addColumn(ColumnType.NUMBER, nameStat);
    }
   
    //dataTable.addRows(years.length);
    //
    CommunityAccount commAccount = listAccount.get(0);
    //String  tabDates[] = new String [100] ;
    //init tabDates
    int i = 0;
//    for(String date :commAccount.listDates) {
//      tabDates[i] = date;
//      i++;
//    }
   
   
//    //wn8 directe
//    Double [] tabWn8= new Double [100];
//    i = 0;
//    for(DataPlayerInfos data :commAccount.listDataPlayerInfos) {
//      tabWn8[i] = data.getStatistics().getAllStatistics().getWn8();
//      i++;
//    }
    //
    //wn8 directe
//    Double [] tabWr= new Double [100];
//    i = 0;
//    for(DataPlayerInfos data :commAccount.listDataPlayerInfos) {
//      tabWr[i] = data.getStatistics().getAllStatistics().getBattle_avg_performanceCalc()*100;
//      i++;
//    }
   
   
//    Integer [] tabBattlesWins = new Integer [100];
//    i = 0;
//    for(Integer wn :commAccount.listBattlesWins) {
//      tabBattlesWins[i] = wn;
//      i++;
//    }
   
//    Integer [] tabBattles = new Integer [100];
//    i = 0;
//    for(Integer wn :commAccount.listbattles) {
//      tabBattles[i] = wn;
//      i++;
//    }
   
    //
    dataTable.addRows(commAccount.listDates.size());
   
//    for (int i = 0; i < years.length; i++) {
//      dataTable.setValue(i, 0, String.valueOf(years[i]));
//    }
    //
    //on set la légende des abscisses ligne 0
//    i = 0;
//    for (String date: commAccount.listDates ) {
//      //String partdate= date.substring(0, 8);
//      dataTable.setValue(i, 0, String.valueOf(i));
//      i++;
//    }
    for (int row = 0; row < commAccount.listDates.size(); row++) {
      int index = commAccount.listDates.size() -1 ;
      index = index - row;
      String partdate = commAccount.listDates.get(index);
      //dd-Mm-AAAA
      partdate = partdate.substring(0, 5);
      dataTable.setValue(row, 0, String.valueOf(partdate));
     
     
    }
    //
//    for (int col = 0; col < values.length; col++) {
//      for (int row = 0; row < values[col].length; row++) {
   
   
//        dataTable.setValue(row, col + 1, values[col][row]);
//      }
//    }
    //
//    for (int col = 0; col < listStats.size() ; col++) {
//      for (int row = 0; row < commAccount.listDates.size(); row++) {
//        int bw = tabBattlesWins[col] ;
//        int b = tabBattles[col] ;
//        double db =  (double)bw/(double)b ;
//        int intdb = (int) (db * 100);
//        db = (double) intdb / (double)100 ;
//        dataTable.setValue(row, col + 1, db);
//      }
//    }
//   
    int col = 0 ;
    double avg = 0.0;
    int previousNbBattle = 0;
    for (CommunityAccount commAcc: listAccount) {
      avg = 0.0;
      previousNbBattle = 0;
      for (int row = 0; row < commAccount.listDates.size(); row++) {
        int index = commAccount.listDates.size() -1 ;
        index = index - row;
         DataPlayerInfos dataPlayerInfos = commAcc.listDataPlayerInfos.get(index);
         if (stat.equalsIgnoreCase("WN8")) {
           double tmp = dataPlayerInfos.getStatistics().getAllStatistics().getWn8();
          
           if (dataPlayerInfos.getStatistics().getAllStatistics().getWn8()!=0 && !Double.isNaN(dataPlayerInfos.getStatistics().getAllStatistics().getWn8())){
             avg = dataPlayerInfos.getStatistics().getAllStatistics().getWn8();
           }
           if (avg != 0.0) {
             int nb = (int) (avg * 100);
             avg = (double)nb/100;
             dataTable.setValue(row, col + 1, avg);
           }
         }
        
         if (stat.equalsIgnoreCase("WR")) {
           if (dataPlayerInfos.getStatistics().getAllStatistics().getBattle_avg_performanceCalc() ==null) {
             if (dataPlayerInfos.getStatistics().getAllStatistics().getWins() !=0 && dataPlayerInfos.getStatistics().getAllStatistics().getBattles() != 0) {
               avg = (double)dataPlayerInfos.getStatistics().getAllStatistics().getWins()/ (double)dataPlayerInfos.getStatistics().getAllStatistics().getBattles();
               avg = avg *100 ;
             }
             if (avg != 0.0)
               dataTable.setValue(row, col + 1, avg);
           } else {
             avg = dataPlayerInfos.getStatistics().getAllStatistics().getBattle_avg_performanceCalc() 100 ;
             if (avg != 0.0) {
               int nb = (int) (avg * 100);
               avg = (double)nb/100;
               dataTable.setValue(row, col + 1, avg);
             }
           }
         }
        
         if (stat.equalsIgnoreCase("BATTLE")) {
//           if (dataPlayerInfos.getStatistics().getAllStatistics().getBattle_avg_performanceCalc() == null) {
//             if (dataPlayerInfos.getStatistics().getAllStatistics().getWins() !=0 && dataPlayerInfos.getStatistics().getAllStatistics().getBattles() != 0) {
//               avg = (double)dataPlayerInfos.getStatistics().getAllStatistics().getWins()/ (double)dataPlayerInfos.getStatistics().getAllStatistics().getBattles();
//               avg = avg *100 ;
//             }
//             if (avg != 0.0)
//               dataTable.setValue(row, col + 1, avg);
//           } else {
//             avg = dataPlayerInfos.getStatistics().getAllStatistics().getBattle_avg_performanceCalc() *  100 ;
//             if (avg != 0.0) {
//               int nb = (int) (avg * 100);
//               avg = (double)nb/100;
//               dataTable.setValue(row, col + 1, avg);
//             }
//           }
           if (dataPlayerInfos.getStatistics().getAllStatistics()!= null) {
             int nbBattle = dataPlayerInfos.getStatistics().getAllStatistics().getBattles();
             avg = nbBattle;
             if (previousNbBattle == 0 )
               dataTable.setValue(row, col + 1, previousNbBattle);
             else {
               //diff par rapoort au précédent
               dataTable.setValue(row, col + 1, nbBattle - previousNbBattle);
             }
             previousNbBattle = nbBattle;
              
           }else {
             dataTable.setValue(row, col + 1, avg);
           }
         }
      }
     
      col++;
View Full Code Here


        }
        return gTable;
    }

    protected DataTable createTableFromDataSet() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        List<DataColumn> columns = dataSet.getColumns();
        for (int i = 0; i < columns.size(); i++) {
            DataColumn dataColumn = columns.get(i);
            List columnValues = dataColumn.getValues();
            ColumnType columnType = dataColumn.getColumnType();
            gTable.addColumn(getColumnType(dataColumn), dataColumn.getId(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

        }
        return gTable;
    }

    public DataTable createTableFromDisplayerSettings() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        int columnIndex = 0;

        List<DisplayerSettingsColumn> displayerSettingsColumns = displayerSettings.getColumnList();
        for (int i = 0; i < displayerSettingsColumns.size(); i++) {
            DisplayerSettingsColumn displayerSettingsColumn = displayerSettingsColumns.get(i);
            DataColumn dataColumn = null;
            if (displayerSettingsColumn.getColumnId() != null) dataColumn = dataSet.getColumnById(displayerSettingsColumn.getColumnId());
            else dataColumn = dataSet.getColumnByIndex(columnIndex++);
            if (dataColumn == null) {
                throw new RuntimeException("Displayer column not found in the data set: " + displayerSettingsColumn.getDisplayName());
            }

            ColumnType columnType = dataColumn.getColumnType();
            List columnValues = dataColumn.getValues();
            gTable.addColumn(getColumnType(dataColumn), displayerSettingsColumn.getDisplayName(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

        super.onGroupIntervalsReset(displayer, groupOps);
    }

    @Override
    public Widget createVisualization() {
        final DataTable dataTable = createTable();
        table = new Table();
        table.addSortHandler( new SortHandler() {
            @Override public void onSort( SortEvent sortEvent ) {
                String columnId = dataTable.getColumnId(sortEvent.getColumn());
                sortApply(columnId, sortInfo.getSortOrder(columnId));
                redraw();
            }
        } );
View Full Code Here

        }
        return gTable;
    }

    protected DataTable createTableFromDataSet() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        List<DataColumn> columns = dataSet.getColumns();
        for (int i = 0; i < columns.size(); i++) {
            DataColumn dataColumn = columns.get(i);
            List columnValues = dataColumn.getValues();
            ColumnType columnType = dataColumn.getColumnType();
            gTable.addColumn(getColumnType(dataColumn), dataColumn.getId(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

        }
        return gTable;
    }

    public DataTable createTableFromDisplayerSettings() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        int columnIndex = 0;

        List<DisplayerSettingsColumn> displayerSettingsColumns = displayerSettings.getColumnList();
        for (int i = 0; i < displayerSettingsColumns.size(); i++) {
            DisplayerSettingsColumn displayerSettingsColumn = displayerSettingsColumns.get(i);
            DataColumn dataColumn = null;
            if (displayerSettingsColumn.getColumnId() != null) dataColumn = dataSet.getColumnById(displayerSettingsColumn.getColumnId());
            else dataColumn = dataSet.getColumnByIndex(columnIndex++);
            if (dataColumn == null) {
                throw new RuntimeException("Displayer column not found in the data set: " + displayerSettingsColumn.getDisplayName());
            }

            ColumnType columnType = dataColumn.getColumnType();
            List columnValues = dataColumn.getValues();
            gTable.addColumn(getColumnType(dataColumn), displayerSettingsColumn.getDisplayName(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

        super.onGroupIntervalsReset(displayer, groupOps);
    }

    @Override
    public Widget createVisualization() {
        final DataTable dataTable = createTable();
        table = new Table();
        table.addSortHandler( new SortHandler() {
            @Override public void onSort( SortEvent sortEvent ) {
                String columnId = dataTable.getColumnId(sortEvent.getColumn());
                sortApply(columnId, sortInfo.getSortOrder(columnId));
                redraw();
            }
        } );
View Full Code Here

        }
        return gTable;
    }

    protected DataTable createTableFromDataSet() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        List<DataColumn> columns = dataSet.getColumns();
        for (int i = 0; i < columns.size(); i++) {
            DataColumn dataColumn = columns.get(i);
            List columnValues = dataColumn.getValues();
            ColumnType columnType = dataColumn.getColumnType();
            gTable.addColumn(getColumnType(dataColumn), dataColumn.getId(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

        }
        return gTable;
    }

    public DataTable createTableFromDisplayerSettings() {
        DataTable gTable = DataTable.create();
        gTable.addRows(dataSet.getRowCount());
        int columnIndex = 0;

        List<DisplayerSettingsColumn> displayerSettingsColumns = displayerSettings.getColumnList();
        for (int i = 0; i < displayerSettingsColumns.size(); i++) {
            DisplayerSettingsColumn displayerSettingsColumn = displayerSettingsColumns.get(i);
            DataColumn dataColumn = null;
            if (displayerSettingsColumn.getColumnId() != null) dataColumn = dataSet.getColumnById(displayerSettingsColumn.getColumnId());
            else dataColumn = dataSet.getColumnByIndex(columnIndex++);
            if (dataColumn == null) {
                throw new RuntimeException("Displayer column not found in the data set: " + displayerSettingsColumn.getDisplayName());
            }

            ColumnType columnType = dataColumn.getColumnType();
            List columnValues = dataColumn.getValues();
            gTable.addColumn(getColumnType(dataColumn), displayerSettingsColumn.getDisplayName(), dataColumn.getId());
            for (int j = 0; j < columnValues.size(); j++) {
                Object value = columnValues.get(j);
                setTableValue(gTable, columnType, value, j, i);
            }
        }
View Full Code Here

TOP

Related Classes of com.googlecode.gwt.charts.client.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.