private DataTable getSingleHistogramDataTable(String env, Dataset.TYPE dataset) { DataTable dataTable = DataTable.create(); dataTable.addColumn(ColumnType.STRING, "Phenotype Value", "x-axis"); dataTable.addColumn(ColumnType.NUMBER, "Frequency", "y-axis"); DataTable histogramDataTable = null; if (dataset == Dataset.TYPE.bisulfite) histogramDataTable = bsHistogramDataTable; else histogramDataTable = mRNAHistogramDataTable; dataTable.addRows(histogramDataTable.getNumberOfRows()); for (int i = 0; i < histogramDataTable.getNumberOfRows(); i++) { dataTable.setValue(i, 0, histogramDataTable.getValueString(i, 0)); dataTable.setValue(i, 1, histogramDataTable.getValueInt(i, (env.equals("T16C") ? 2 : 1))); } return dataTable; }
private AbstractDataTable createTable(Collection<Course> courses) { data = DataTable.create(); data.addColumn(ColumnType.STRING, "Course"); data.addColumn(ColumnType.NUMBER, "Year"); data.addColumn(ColumnType.NUMBER, "Semester"); data.addColumn(ColumnType.STRING, "Activity"); data.addColumn(ColumnType.NUMBER, "Documents"); for (Course course : courses) { for (WritingActivity writingActivity : course.getWritingActivities()) { data.addRows(1); data.setValue(data.getNumberOfRows() - 1, 0, course.getName()); data.setValue(data.getNumberOfRows() - 1, 1, course.getYear()); data.setValue(data.getNumberOfRows() - 1, 2, course.getSemester()); data.setValue( data.getNumberOfRows() - 1, 3, writingActivity.getName() + " (" + writingActivity.getTutorial() + ")"); data.setValue(data.getNumberOfRows() - 1, 4, writingActivity.getEntries().size()); } } return data; }