private void updateItemWithNumericBar()

in codeexplorer/src/main/java/nl/obren/sokrates/codeexplorer/common/NumericBarCellFactory.java [54:76]


    private void updateItemWithNumericBar(TableCell tableCell, double itemValue) {
        double max = maxCountCallback != null && maxCountCallback.call(null) != null ? maxCountCallback.call(null).doubleValue() : 1;

        if (max > 0) {
            Rectangle r = new Rectangle();
            Color color = getColor(itemValue);
            r.setFill(color);
            double value = 1 + 20 * (itemValue / max);
            r.setWidth(value);
            r.setHeight(18);
            tableCell.setGraphic(r);
        }

        String pattern = "###,###";
        DecimalFormat decimalFormat = new DecimalFormat(pattern);

        String text = decimalFormat.format(itemValue);
        if (compareToValueCallback != null && compareToValueCallback.call(null).doubleValue() > 0) {
            double percentage = 100.0 * itemValue / compareToValueCallback.call(null).doubleValue();
            text += " (" + (percentage < 1 && percentage > 0 ? "<1" : percentage == 0 ? "0" : (int) (percentage + 0.5)) + "%)";
        }
        tableCell.setText(text);
    }