timing.ui: better hide the 0 line of the density chart
Hide the blue line that was at 0. As chart is logarithmic the value
cannot be zero by default.
[fixed] Don't show the blue line at the bottom of a 0 in the density chart
Change-Id: Ia96ef6eca9a7125004a75a674e13b1676dc42809
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/160138
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java
index d71de89..75b3150 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/AbstractSegmentStoreDensityViewer.java
@@ -151,7 +151,8 @@
final int width = fOverrideNbPoints == 0 ? fChart.getPlotArea().getBounds().width / barWidth : fOverrideNbPoints;
double[] xOrigSeries = new double[width];
double[] yOrigSeries = new double[width];
- Arrays.fill(yOrigSeries, 1.0);
+ // Set a positive value that is greater than 0 and less than 1.0
+ Arrays.fill(yOrigSeries, Double.MIN_VALUE);
data.setComparator(SegmentComparators.INTERVAL_LENGTH_COMPARATOR);
ISegment maxSegment = data.getElement(SegmentStoreWithRange.LAST);
long maxLength = Long.MAX_VALUE;
@@ -162,7 +163,11 @@
long minX = Long.MAX_VALUE;
for (ISegment segment : data) {
double xBox = segment.getLength() * maxFactor * width;
- yOrigSeries[(int) xBox]++;
+ if (yOrigSeries[(int) xBox] < 1) {
+ yOrigSeries[(int) xBox] = 1;
+ } else {
+ yOrigSeries[(int) xBox]++;
+ }
minX = Math.min(minX, segment.getLength());
}
double timeWidth = (double) maxLength / (double) width;