Class LineTraceImpl

java.lang.Object
org.dawnsci.plotting.system.LineTraceImpl
Type Parameters:
T -
All Implemented Interfaces:
ILineTrace, ITrace, org.eclipse.january.INameable, org.eclipse.nebula.visualization.xygraph.figures.ITraceListener

public class LineTraceImpl extends Object implements ILineTrace, org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
This class only wraps line traces, images have their own IImageTrace implementor.
See Also:
  • Constructor Details

    • LineTraceImpl

      public LineTraceImpl()
  • Method Details

    • initialize

      public void initialize(IAxis... axes)
      Description copied from interface: ITrace
      Initialize with given axes
      Specified by:
      initialize in interface ITrace
      Parameters:
      axes -
    • getDataProvider

      public org.eclipse.nebula.visualization.xygraph.dataprovider.IDataProvider getDataProvider()
    • getTraceType

      public ILineTrace.TraceType getTraceType()
      Specified by:
      getTraceType in interface ILineTrace
    • setTraceType

      public void setTraceType(ILineTrace.TraceType traceType)
      Description copied from interface: ILineTrace
      Set TraceType. For instance change to a bar plot by calling this.
      Specified by:
      setTraceType in interface ILineTrace
      Parameters:
      traceType -
    • setTraceColor

      public void setTraceColor(org.eclipse.swt.graphics.Color traceColor)
      Description copied from interface: ILineTrace
      The Color of the trace
      Specified by:
      setTraceColor in interface ILineTrace
      Parameters:
      traceColor -
    • getTraceColor

      public org.eclipse.swt.graphics.Color getTraceColor()
      Specified by:
      getTraceColor in interface ILineTrace
    • getPointStyle

      public ILineTrace.PointStyle getPointStyle()
      Specified by:
      getPointStyle in interface ILineTrace
    • setPointStyle

      public void setPointStyle(ILineTrace.PointStyle pointStyle)
      Description copied from interface: ILineTrace
      The style of points if plotted by the trace.
      Specified by:
      setPointStyle in interface ILineTrace
      Parameters:
      pointStyle -
    • setLineWidth

      public void setLineWidth(int lineWidth)
      Description copied from interface: ILineTrace
      The width of line plotted, if trace is a line plot.
      Specified by:
      setLineWidth in interface ILineTrace
      Parameters:
      lineWidth -
    • setPointSize

      public void setPointSize(int pointSize)
      Description copied from interface: ILineTrace
      The size of points plotted if Trace is a Line type.
      Specified by:
      setPointSize in interface ILineTrace
      Parameters:
      pointSize -
    • setAreaAlpha

      public void setAreaAlpha(int areaAlpha)
      Description copied from interface: ILineTrace
      The transparency of areas draw by the trace (for instance in HISTO trace type or FILL trace type).
      Specified by:
      setAreaAlpha in interface ILineTrace
      Parameters:
      areaAlpha -
    • setAntiAliasing

      public void setAntiAliasing(boolean antiAliasing)
      Description copied from interface: ILineTrace
      Turn on anti-aliasing of 1D plots here. No effect on images.
      Specified by:
      setAntiAliasing in interface ILineTrace
      Parameters:
      antiAliasing -
    • setName

      public void setName(String name)
      Specified by:
      setName in interface org.eclipse.january.INameable
    • getName

      public String getName()
      Specified by:
      getName in interface org.eclipse.january.INameable
    • getPointSize

      public int getPointSize()
      Specified by:
      getPointSize in interface ILineTrace
    • getAreaAlpha

      public int getAreaAlpha()
      Specified by:
      getAreaAlpha in interface ILineTrace
    • setErrorBarEnabled

      public void setErrorBarEnabled(boolean errorBarEnabled)
      Description copied from interface: ILineTrace
      For 1D traces
      Specified by:
      setErrorBarEnabled in interface ILineTrace
      Parameters:
      errorBarEnabled -
    • getYErrorBarType

      public ILineTrace.ErrorBarType getYErrorBarType()
      Specified by:
      getYErrorBarType in interface ILineTrace
    • getXErrorBarType

      public ILineTrace.ErrorBarType getXErrorBarType()
      Specified by:
      getXErrorBarType in interface ILineTrace
    • setYErrorBarType

      public void setYErrorBarType(ILineTrace.ErrorBarType errorBarType)
      Description copied from interface: ILineTrace
      If showing error bars, sets the y error bar type. Use setErrorBarEnabled(...) to start showing the error bars.
      Specified by:
      setYErrorBarType in interface ILineTrace
      Parameters:
      errorBarType -
    • setXErrorBarType

      public void setXErrorBarType(ILineTrace.ErrorBarType errorBarType)
      Description copied from interface: ILineTrace
      If showing error bars, sets the y error bar type. Use setErrorBarEnabled(...) to start showing the error bars.
      Specified by:
      setXErrorBarType in interface ILineTrace
      Parameters:
      errorBarType -
    • setErrorBarCapWidth

      public void setErrorBarCapWidth(int errorBarCapWidth)
    • setErrorBarColor

      public void setErrorBarColor(org.eclipse.swt.graphics.Color errorBarColor)
      Description copied from interface: ILineTrace
      Color of error bars.
      Specified by:
      setErrorBarColor in interface ILineTrace
      Parameters:
      errorBarColor -
    • getLineWidth

      public int getLineWidth()
      Specified by:
      getLineWidth in interface ILineTrace
    • getErrorBarCapWidth

      public int getErrorBarCapWidth()
    • getErrorBarColor

      public org.eclipse.swt.graphics.Color getErrorBarColor()
      Specified by:
      getErrorBarColor in interface ILineTrace
    • isAntiAliasing

      public boolean isAntiAliasing()
      Specified by:
      isAntiAliasing in interface ILineTrace
    • isErrorBarEnabled

      public boolean isErrorBarEnabled()
      Specified by:
      isErrorBarEnabled in interface ILineTrace
    • getData

      public org.eclipse.january.dataset.IDataset getData()
      Description copied from interface: ITrace
      Call this method to return a plotted data set by this trace. Different trace types will return different ranks from getData(). For ILineTrace it is 1D line data For IImageTrace it is a 2D image etc.
      Specified by:
      getData in interface ITrace
    • getYData

      public org.eclipse.january.dataset.IDataset getYData()
      Description copied from interface: ILineTrace
      The Y data of the plot, considered as the main data as the x-data might often be indices of y.
      Specified by:
      getYData in interface ILineTrace
      Returns:
    • getXData

      public org.eclipse.january.dataset.IDataset getXData()
      Description copied from interface: ILineTrace
      The x data of the plot - might often be indices of y.
      Specified by:
      getXData in interface ILineTrace
      Returns:
    • getErrorBarWidth

      public int getErrorBarWidth()
      Specified by:
      getErrorBarWidth in interface ILineTrace
    • setErrorBarWidth

      public void setErrorBarWidth(int errorBarCapWidth)
      The size of the error bar in pixels not real coordinates.
      Specified by:
      setErrorBarWidth in interface ILineTrace
      Parameters:
      errorBarCapWidth -
    • getTrace

      public org.eclipse.nebula.visualization.xygraph.figures.Trace getTrace()
    • setData

      public void setData(org.eclipse.january.dataset.IDataset xData, org.eclipse.january.dataset.IDataset yData)
      You may need a repaint after calling this
      Specified by:
      setData in interface ILineTrace
      Parameters:
      yData -
    • isVisible

      public boolean isVisible()
      Description copied from interface: ITrace
      True if visible
      Specified by:
      isVisible in interface ITrace
      Returns:
    • setVisible

      public void setVisible(boolean isVisible)
      Description copied from interface: ITrace
      True if visible
      Specified by:
      setVisible in interface ITrace
    • repaint

      public void repaint()
      Description copied from interface: ILineTrace
      May be called to refresh the whole graph, for instance if you change trace color, you may need to repaint the legend.
      Specified by:
      repaint in interface ILineTrace
    • isUserTrace

      public boolean isUserTrace()
      Description copied from interface: ITrace
      True if user trace (normally is)
      Specified by:
      isUserTrace in interface ITrace
      Returns:
    • setUserTrace

      public void setUserTrace(boolean isUserTrace)
      Description copied from interface: ITrace
      True if visible
      Specified by:
      setUserTrace in interface ITrace
    • getUserObject

      public Object getUserObject()
      Description copied from interface: ITrace
      An object which may be set by API users to record information about the plot. Ideally avoid objects containing large data in this method.
      Specified by:
      getUserObject in interface ITrace
      Returns:
    • setUserObject

      public void setUserObject(Object userObject)
      Description copied from interface: ITrace
      An object which may be set by API users to record information about the plot. Ideally avoid objects containing large data in this method.
      Specified by:
      setUserObject in interface ITrace
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • is3DTrace

      public boolean is3DTrace()
      Specified by:
      is3DTrace in interface ITrace
      Returns:
      true if trace is plotted using a 3D viewer.
    • dispose

      public void dispose()
      Description copied from interface: ITrace
      Called to release system resources.
      Specified by:
      dispose in interface ITrace
    • getRank

      public int getRank()
      Description copied from interface: ITrace
      The rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes.
      Specified by:
      getRank in interface ITrace
      Returns:
    • getXAxis

      public IAxis getXAxis()
      Specified by:
      getXAxis in interface ILineTrace
      Returns:
      The x-axis which this trace is being drawn with
    • getYAxis

      public IAxis getYAxis()
      Specified by:
      getYAxis in interface ILineTrace
      Returns:
      The y-axis which this trace is being drawn with
    • getDataName

      public String getDataName()
      Description copied from interface: ITrace
      The name of the original data that this trace was plotted from or null
      Specified by:
      getDataName in interface ITrace
      Returns:
    • setDataName

      public void setDataName(String dataName)
      Description copied from interface: ITrace
      The name of the original data that this trace was plotted from or null
      Specified by:
      setDataName in interface ITrace
    • traceWidthChanged

      public void traceWidthChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, int old, int newWidth)
      Specified by:
      traceWidthChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • traceNameChanged

      public void traceNameChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, String oldName, String newName)
      Specified by:
      traceNameChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • traceYAxisChanged

      public void traceYAxisChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.nebula.visualization.xygraph.figures.Axis oldName, org.eclipse.nebula.visualization.xygraph.figures.Axis newName)
      Specified by:
      traceYAxisChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • traceTypeChanged

      public void traceTypeChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.nebula.visualization.xygraph.figures.Trace.TraceType old, org.eclipse.nebula.visualization.xygraph.figures.Trace.TraceType newTraceType)
      Specified by:
      traceTypeChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • pointStyleChanged

      public void pointStyleChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.nebula.visualization.xygraph.figures.Trace.PointStyle old, org.eclipse.nebula.visualization.xygraph.figures.Trace.PointStyle newStyle)
      Specified by:
      pointStyleChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • traceColorChanged

      public void traceColorChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.swt.graphics.Color old, org.eclipse.swt.graphics.Color newColor)
      Specified by:
      traceColorChanged in interface org.eclipse.nebula.visualization.xygraph.figures.ITraceListener
    • setDrawYErrorInArea

      public void setDrawYErrorInArea(boolean drawYErrorInArea)
      Description copied from interface: ILineTrace
      Set the Y error to draw as an area instead of discrete points
      Specified by:
      setDrawYErrorInArea in interface ILineTrace
      Parameters:
      drawYErrorInArea -
    • isDrawYErrorInArea

      public boolean isDrawYErrorInArea()
      Description copied from interface: ILineTrace
      Return if the Y error is set to draw as an area instead of discrete points
      Specified by:
      isDrawYErrorInArea in interface ILineTrace
      Returns: