From 6536611b5db9292cbb5163f27e406a5974a317a9 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 26 Oct 2020 10:50:54 +0100 Subject: [PATCH] print only bar chart tics when they are greater than zero --- .../plot/api/BarChartAggregatorForIntervals.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pdb-plotting/src/main/java/org/lucares/pdb/plot/api/BarChartAggregatorForIntervals.java b/pdb-plotting/src/main/java/org/lucares/pdb/plot/api/BarChartAggregatorForIntervals.java index e3cd661..8e14f69 100644 --- a/pdb-plotting/src/main/java/org/lucares/pdb/plot/api/BarChartAggregatorForIntervals.java +++ b/pdb-plotting/src/main/java/org/lucares/pdb/plot/api/BarChartAggregatorForIntervals.java @@ -134,13 +134,15 @@ public class BarChartAggregatorForIntervals implements CustomAggregator, Indexed int offset = 0; for (final String bucketId : bucketIds()) { final long count = buckets.get(bucketId).get(); - final String label = String.format(Locale.US, "set label at %s %f, %d '%s' center front offset 0,0.3\n", // front - xAxis == GnuplotAxis.X1 ? "first" : "second", // - offset + getIndex() * SPACE_BETWEEN_BARS + 0.5, // x-axis position of the label - count, // y axis position of the label - String.format(Locale.US, "%,d", count)); + if (count > 0) { + final String label = String.format(Locale.US, "set label at %s %f, %d '%s' center front offset 0,0.3\n", // front + xAxis == GnuplotAxis.X1 ? "first" : "second", // + offset + getIndex() * SPACE_BETWEEN_BARS + 0.5, // x-axis position of the label + count, // y axis position of the label + String.format(Locale.US, "%,d", count)); - result.append(label); + result.append(label); + } offset += numberOfDataSeries; }