@Override
    public String generateLabel(CategoryDataset dataset, int row, int column) {
        if (minLabels == null || maxLabels == null) return "";
        String minMax = dataset.getRowKey(row).toString();
        String xkey = dataset.getColumnKey(column).toString();
        Number yval = dataset.getValue(row, column);
        
        if (minMax.equals("min")) {
            Pair<Double, String> pair = minLabels.get(xkey);
            if (pair != null && pair.first.equals(yval)) {
                return pair.second;
            }
        } else {
            Pair<Double, String> pair = maxLabels.get(xkey);
            if (pair != null && pair.first.equals(yval)) {
                return pair.second;
            }
        }
        return "";
    }