From 3493d03e5b18c222398fd2108033bb77a8326978 Mon Sep 17 00:00:00 2001 From: gcolon021 Date: Thu, 2 Nov 2023 09:13:57 -0400 Subject: [PATCH] [ALS-4957] Fix label of graphs with a single bin --- .../visualization/service/DataProcessingService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pic-sure-resources/pic-sure-visualization-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/DataProcessingService.java b/pic-sure-resources/pic-sure-visualization-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/DataProcessingService.java index 15434dc1..cf989fed 100644 --- a/pic-sure-resources/pic-sure-visualization-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/DataProcessingService.java +++ b/pic-sure-resources/pic-sure-visualization-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/DataProcessingService.java @@ -255,16 +255,22 @@ private static Map createLabelsForBins(Map re } Integer lastCount = finalMap.get(label); - //Last label should be the min in the range with a '+' sign. Only if there is more than one bin. - if (lastCount != null && results.size() > 1) { + if (lastCount != null && finalMap.size() > 1) { String newLabel = label; int hasDash = label.indexOf(" -"); if (hasDash > 0) { newLabel = label.substring(0, hasDash); } + finalMap.remove(label); finalMap.put(newLabel + " +", lastCount); + } else if (lastCount != null) { + // If there is only one bin + // Remove the range and just use the max value + finalMap.remove(label); + finalMap.put(String.format("%.1f", ranges.get(0).get(1)), lastCount); } + return finalMap; }