private Node getReferenceTable(Results r) { String[] subH = new String[r.getNumberOfClusters()]; for (int i = 0; i < subH.length; i++) subH[i] = "Cluster " + i; DataTable refTable = new DataTable(); refTable.addHiddenClusterHeaders(subH); // Fetch the reference labels String[] refLabels = r.getReferenceLabels(); refTable.setLabelRowRelationship(getReferenceRowRelationship(refLabels)); refTable.setTotalLabelCount(mRefLabelToRow.size()); // For each cluster, we add the reference data means as labels, and link that data to the // corresponding label double[][] refMeans = r.getReferenceDataMeans(); for (int col = 0; col < r.getNumberOfClusters(); col++) { ArrayList<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>(); double[] thisCol = refMeans[col]; for (int j = 0; j < refLabels.length; j++) { Pair<String, String> pair = new Pair<String, String>(refLabels[j], String.valueOf(thisCol[j])); pairs.add(pair); } refTable.setColumnData(col, mRefLabelToRow.size(), pairs); } mRefDataTables.add(refTable); return refTable; }
/** Creates the basic layout, with the left label grid and the similar */ private void createBaseLayout() { label_box = new VBox(); wrap_pane.getChildren().add(label_box); mLabelTable = new DataTable( " ", " "); // We want the extra spacing that having a heading gives, to keep in line with the // data labels mRefLabelTable = new DataTable(); mRefLabelTable.addHiddenClusterHeaders(" "); label_box.getChildren().add(mLabelTable); label_box.getChildren().add(mRefLabelTable); wrap_pane.setMinWidth(1); addVerticalSeparator(); first = false; }