Class Trace

    • Field Detail

      • MARKER_SIZE

        private static final int MARKER_SIZE
        Size of 'markers' used on X axis to indicate non-plottable samples
        See Also:
        Constant Field Values
      • use_advanced_graphics

        private final boolean use_advanced_graphics
        Use advanced graphics? Might not make a real performance difference, but since this it called a lot, keep it in variable
      • listeners

        private final java.util.List<ITraceListener> listeners
        List of trace listeners
      • name

        private java.lang.String name
      • xAxis

        private Axis xAxis
      • yAxis

        private Axis yAxis
      • traceColor

        private org.eclipse.swt.graphics.Color traceColor
        Color used to draw the main line/marker of the trace. Also used for error bars unless errorBarColor is defined
      • lineWidth

        private int lineWidth
        If traceType is bar, this is the width of the bar.
      • pointSize

        private int pointSize
      • areaAlpha

        private int areaAlpha
      • antiAliasing

        private boolean antiAliasing
      • errorBarEnabled

        private boolean errorBarEnabled
      • errorBarCapWidth

        private int errorBarCapWidth
      • errorBarColorSetFlag

        private boolean errorBarColorSetFlag
      • errorBarColor

        private org.eclipse.swt.graphics.Color errorBarColor
        Color used for error bars. If null, traceColor is used
      • drawYErrorInArea

        private boolean drawYErrorInArea
      • hotSampleist

        private java.util.List<ISample> hotSampleist
    • Method Detail

      • removeListener

        public boolean removeListener​(ITraceListener listener)
      • setPointStyleProvider

        public void setPointStyleProvider​(IPointStyleProvider pointStyleProvider)
      • drawErrorBar

        private void drawErrorBar​(org.eclipse.draw2d.Graphics graphics,
                                  org.eclipse.draw2d.geometry.Point dpPos,
                                  ISample dp)
      • drawYErrorArea

        private void drawYErrorArea​(org.eclipse.draw2d.Graphics graphics,
                                    ISample predp,
                                    ISample dp,
                                    org.eclipse.draw2d.geometry.Point predpPos,
                                    org.eclipse.draw2d.geometry.Point dpPos)
      • drawPoint

        public void drawPoint​(org.eclipse.draw2d.Graphics graphics,
                              org.eclipse.draw2d.geometry.Point pos)
        Draw point with the pointStyle and size of the trace;
        Parameters:
        graphics -
        pos -
      • drawPoint

        private void drawPoint​(org.eclipse.draw2d.Graphics graphics,
                               org.eclipse.draw2d.geometry.Point pos,
                               ISample sample)
      • drawLine

        public void drawLine​(org.eclipse.draw2d.Graphics graphics,
                             org.eclipse.draw2d.geometry.Point p1,
                             org.eclipse.draw2d.geometry.Point p2)
        Draw line with the line style and line width of the trace.
        Parameters:
        graphics -
        p1 -
        p2 -
      • drawPolyline

        private void drawPolyline​(org.eclipse.draw2d.Graphics graphics,
                                  org.eclipse.draw2d.geometry.PointList pl)
        Draw polyline with the line style and line width of the trace.
        Parameters:
        graphics -
        pl -
      • paintFigure

        protected void paintFigure​(org.eclipse.draw2d.Graphics graphics)
        Overrides:
        paintFigure in class org.eclipse.draw2d.Figure
      • paintInternalFigure

        private void paintInternalFigure​(org.eclipse.draw2d.Graphics graphics)
      • getIntersection

        private ISample[] getIntersection​(ISample dp1,
                                          ISample dp2)
        Compute axes intersection considering the 'TraceType'
        Parameters:
        dp1 - 'Start' point of line
        dp2 - 'End' point of line
        Returns:
        The intersection points with the axes when draw the line between the two data points. The index 0 of the result is the first intersection point. index 1 is the second one.
      • getStraightLineIntersection

        private ISample[] getStraightLineIntersection​(ISample dp1,
                                                      ISample dp2)
        Compute intersection of straight line with axes, no correction for 'TraceType'.
        Parameters:
        dp1 - 'Start' point of line
        dp2 - 'End' point of line
        Returns:
        The intersection points between the line, which is the straight line between the two data points, and the axes. Result could be { null, null }, { point1, null } or { point1, point2 }.
      • evalDP

        private boolean evalDP​(double x,
                               double y,
                               ISample dp1,
                               ISample dp2)
        Sanity check: Point x/y was computed to be an axis intersection, but that can fail because of rounding errors or for samples with NaN, Infinity. Is it in the plot area? Is it between the start/end points.
        Parameters:
        x -
        y -
        dp1 -
        dp2 -
        Returns:
        true if the point (x,y) is between dp1 and dp2 BUT not equal to either AND within the x/y axes. false otherwise
      • setXAxis

        public void setXAxis​(Axis axis)
        Parameters:
        axis - the xAxis to set
      • getXAxis

        public Axis getXAxis()
        Returns:
        the xAxis
      • setYAxis

        public void setYAxis​(Axis axis)
        Parameters:
        axis - the yAxis to set
      • fireYAxisChanged

        private void fireYAxisChanged​(Axis oldName,
                                      Axis newName)
      • setDataProvider

        public void setDataProvider​(IDataProvider traceDataProvider)
        Parameters:
        traceDataProvider - the traceDataProvider to set
      • getTraceType

        public Trace.TraceType getTraceType()
        Returns:
        the traceType
      • setTraceColor

        public void setTraceColor​(org.eclipse.swt.graphics.Color traceColor)
        Parameters:
        traceColor - Desired trace color
      • fireTraceColorChanged

        private void fireTraceColorChanged​(org.eclipse.swt.graphics.Color old,
                                           org.eclipse.swt.graphics.Color newColor)
      • getTraceColor

        public org.eclipse.swt.graphics.Color getTraceColor()
        Returns:
        the traceColor
      • setTraceType

        public void setTraceType​(Trace.TraceType traceType)
        Parameters:
        traceType - the traceType to set
      • setBaseLine

        public void setBaseLine​(Trace.BaseLine baseLine)
        Parameters:
        baseLine - the baseLine to set
      • setPointStyle

        public void setPointStyle​(Trace.PointStyle pointStyle)
        Parameters:
        pointStyle - the pointStyle to set
      • setLineWidth

        public void setLineWidth​(int lineWidth)
        Parameters:
        lineWidth - the lineWidth to set
      • setPointSize

        public void setPointSize​(int pointSize)
        Parameters:
        pointSize - the pointSize to set
      • setAreaAlpha

        public void setAreaAlpha​(int areaAlpha)
        Parameters:
        areaAlpha - the areaAlpha to set
      • setAntiAliasing

        public void setAntiAliasing​(boolean antiAliasing)
        Parameters:
        antiAliasing - the antiAliasing to set
      • setName

        public void setName​(java.lang.String name)
        Parameters:
        name - the name of the trace to set
      • setName

        public void setName​(java.lang.String name,
                            boolean fire)
        Parameters:
        name - the name of the trace to set
        fire - if true, a traceNameChanged event is fired
      • fireTraceNameChanged

        private void fireTraceNameChanged​(java.lang.String oldName,
                                          java.lang.String newName)
      • getName

        public java.lang.String getName()
        Returns:
        the name of the trace
      • getPointSize

        public int getPointSize()
        Returns:
        the pointSize
      • getAreaAlpha

        public int getAreaAlpha()
        Returns:
        the areaAlpha
      • getYAxis

        public Axis getYAxis()
        Returns:
        the yAxis
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getIndexRangeOnXAxis

        private Range getIndexRangeOnXAxis()
        Get the corresponding sample index range based on the range of xAxis. This will help trace to draw only the part of data confined in xAxis. So it may also provides the first data out of the range to make the line could be drawn between inside data and outside data. This method only works for chronological data, which means the data is naturally sorted on xAxis.
        Returns:
        the Range of the index.
      • nearBinarySearchX

        private int nearBinarySearchX​(double key,
                                      boolean left)
      • axisRevalidated

        public void axisRevalidated​(Axis axis)
        Description copied from interface: IAxisListener
        This method will be notified by axis whenever the axis is revalidated.
        Specified by:
        axisRevalidated in interface IAxisListener
      • getDataProvider

        public IDataProvider getDataProvider()
        Returns:
        the traceDataProvider
      • setErrorBarEnabled

        public void setErrorBarEnabled​(boolean errorBarEnabled)
        Parameters:
        errorBarEnabled - the errorBarEnabled to set
      • setYErrorBarType

        public void setYErrorBarType​(Trace.ErrorBarType errorBarType)
        Parameters:
        errorBarType - the yErrorBarType to set
      • setXErrorBarType

        public void setXErrorBarType​(Trace.ErrorBarType errorBarType)
        Parameters:
        errorBarType - the xErrorBarType to set
      • setDrawYErrorInArea

        public void setDrawYErrorInArea​(boolean drawYErrorInArea)
        Parameters:
        drawYErrorInArea - the drawYErrorArea to set
      • setErrorBarCapWidth

        public void setErrorBarCapWidth​(int errorBarCapWidth)
        Parameters:
        errorBarCapWidth - the errorBarCapWidth to set
      • setErrorBarColor

        public void setErrorBarColor​(org.eclipse.swt.graphics.Color errorBarColor)
        Parameters:
        errorBarColor - Desired color for error bars, or null to use trace color
      • getHotSampleList

        public java.util.List<ISample> getHotSampleList()
        Hot Sample is the sample on the trace which has been drawn in plot area.
        Returns:
        the hotPointList
      • getBaseLine

        public Trace.BaseLine getBaseLine()
        Returns:
        the baseLine
      • getPointStyle

        public Trace.PointStyle getPointStyle()
        Returns:
        the pointStyle
      • getLineWidth

        public int getLineWidth()
        Returns:
        the lineWidth
      • isAntiAliasing

        public boolean isAntiAliasing()
        Returns:
        the antiAliasing
      • isErrorBarEnabled

        public boolean isErrorBarEnabled()
        Returns:
        the errorBarEnabled
      • getYErrorBarType

        public Trace.ErrorBarType getYErrorBarType()
        Returns:
        the yErrorBarType
      • getXErrorBarType

        public Trace.ErrorBarType getXErrorBarType()
        Returns:
        the xErrorBarType
      • getErrorBarCapWidth

        public int getErrorBarCapWidth()
        Returns:
        the errorBarCapWidth
      • getErrorBarColor

        public org.eclipse.swt.graphics.Color getErrorBarColor()
        Returns:
        Color used for error bars or 'area'
      • isDrawYErrorInArea

        public boolean isDrawYErrorInArea()
        Returns:
        the drawYErrorInArea
      • setXYGraph

        public void setXYGraph​(IXYGraph xyGraph)
        Parameters:
        xyGraph - the xyGraph to set
      • getXYGraph

        public IXYGraph getXYGraph()
        Returns:
        the xyGraph
      • axisForegroundColorChanged

        public void axisForegroundColorChanged​(Axis axis,
                                               org.eclipse.swt.graphics.Color oldColor,
                                               org.eclipse.swt.graphics.Color newColor)
        Specified by:
        axisForegroundColorChanged in interface IAxisListener
      • axisTitleChanged

        public void axisTitleChanged​(Axis axis,
                                     java.lang.String oldTitle,
                                     java.lang.String newTitle)
        Specified by:
        axisTitleChanged in interface IAxisListener
      • dispose

        public void dispose()
        Remove figures and reset fields