From 501678130fc0acc60edc94819990cd80916aed54 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Fri, 14 Oct 2016 12:45:55 -0400 Subject: [PATCH] tmf.ui: make common line charts display the window range, not their model range Change-Id: Ie6cea17dea1490af724adec1d0743d01cad884f6 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/83251 Reviewed-by: Hudson CI Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien --- .../xycharts/linecharts/TmfCommonXLineChartViewer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/linecharts/TmfCommonXLineChartViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/linecharts/TmfCommonXLineChartViewer.java index 1bf9e503bb..10db54ba71 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/linecharts/TmfCommonXLineChartViewer.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/linecharts/TmfCommonXLineChartViewer.java @@ -323,8 +323,8 @@ public abstract class TmfCommonXLineChartViewer extends TmfXYChartViewer { * The array of values for the series */ protected void setSeries(String seriesName, double[] seriesValues) { - if (fXValues.length > seriesValues.length) { - throw new IllegalStateException(); + if (fXValues.length != seriesValues.length) { + throw new IllegalStateException("All series in list must be of length : " + fXValues.length); //$NON-NLS-1$ } fSeriesValues.put(seriesName, seriesValues); } @@ -400,9 +400,8 @@ public abstract class TmfCommonXLineChartViewer extends TmfXYChartViewer { IAxisTick xTick = getSwtChart().getAxisSet().getXAxis(0).getTick(); xTick.setFormat(tmfChartTimeStampFormat); - final double start = xValues[0]; - int lastX = xValues.length - 1; - double end = (start == xValues[lastX]) ? start + 1 : xValues[lastX]; + final double start = 0.0; + double end = getWindowEndTime() - getWindowStartTime(); getSwtChart().getAxisSet().getXAxis(0).setRange(new Range(start, end)); if (maxy > miny) { getSwtChart().getAxisSet().getYAxis(0).setRange(new Range(miny, maxy)); -- 2.34.1