private void transformDataMatrix() { JHeatMapDataOperationsDialog dialog = new JHeatMapDataOperationsDialog(getDialogParent()); dialog.setVisible(true); if(!dialog.isCanceled()) { applyTransformations(dialog.getTransform(), dialog.getCentering()); } }
/** * Constructs a new {@code JHeatMap} taking {@code model} as data source. * * @param model the {@code JHeatMapModel} */ public JHeatMap(JHeatMapModel model) { this(model.getData(), model.getRowNames(), model.getColumnNames()); }
private void setHeatmapFont(Font font) { this.heatmapFont = ofNullable(font); this.heatmap.setHeatmapFont(getHeatmapFont()); }
@Override public Color apply(Double t) { if (isNaN(t)) { return nanColor; } else { double normalized = normalize(checkRange(t), max, min); int colorIndex = (int) ((normalized * (DEFAULT_STEPS - 1))); return colorGradient[colorIndex]; } }
/** * Zooms in the heatmap by a factor of {@code scale}. * * @param scale the scaling factor */ public void zoomIn(double scale) { scaleCellSize(scale); }
/** * Establishes the color for missing values ({@code Double.NaN}). * * @param color the color for missing values */ public void setNanColor(Color color) { this.nanColor = color; this.updateUI(); }
public CustomTableCellRenderer() { super(); this.setOpaque(true); }
private void scaleCellSize(double scale) { this.cellSize = (int) (this.cellSize * scale); this.fixCellSize(); }
private void updateVisibleRows() { updateRowFilter(); }
private void zoomIn() { zoomIn(DEFAULT_ZOOM_SCALE); }
private void zoomOut() { zoomOut((double) 1 / DEFAULT_ZOOM_SCALE); }
private TestRowFilter<Object, Object> getRowFilter() { return new TestRowFilter<>(); }
/** * Constructs a new {@code JHeatMap} taking {@code data} as input data * matrix and {@code rowNames}/{@code columNames} as names for rows and * columns. * * @param data the input data matrix * @param rowNames the names for the rows * @param columnNames the names for the columns */ public JHeatMap(double[][] data, String[] rowNames, String[] columnNames) { this.data = data; this.rowNames = rowNames; this.columnNames = columnNames; this.initComponent(); }
@Override public Object getValueAt(int rowIndex, int columnIndex) { if(rowIndex == 0 && columnIndex == 0) { return ""; } else { if (rowIndex == 0) { return columnNames[columnIndex-1]; } if (columnIndex == 0) { return rowNames[rowIndex-1]; } return new CellValue(data[rowIndex-1][columnIndex-1]); } } }
private JComponent getCenteringComponent() { this.centerMethod = new JComboBox<>(Centering.values()); return centerMethod; }
/** * Returns a list with the column names that are currently visible. * * @return a list with the column names that are currently visible */ public List<String> getVisibleColumnNames() { if (visibleColumns.isPresent()) { return visibleColumns.get(); } else { return getColumnNames(); } }
public static double[][] transform(double[][] matrix, Transform transform) { return MatrixUtils.transform(matrix, transform.getFunction()); } }
/** * Establishes the high color of the gradient. * * @param color the high color of the gradient */ public void setHighColor(Color color) { this.highColor = color; this.colorKey.setHighColor(color); this.initializeColors(); }
/** * Zooms out the heatmap by a factor of {@code scale}. * * @param scale the scaling factor */ public void zoomOut(double scale) { scaleCellSize(scale); }