Skip to content

Commit

Permalink
[ALS-4957] Fix label of graphs with a single bin
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Nov 2, 2023
1 parent 5848e04 commit 3493d03
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,22 @@ private static Map<String, Integer> createLabelsForBins(Map<Integer, Integer> 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;
}

Expand Down

0 comments on commit 3493d03

Please sign in to comment.