Package org.dawnsci.plotting.system
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.dawnsci.plotting.api.trace.ILineTrace
ILineTrace.ErrorBarType, ILineTrace.PointStyle, ILineTrace.TraceType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Called to release system resources.intorg.eclipse.january.dataset.IDatasetgetData()Call this method to return a plotted data set by this trace.The name of the original data that this trace was plotted from or nullorg.eclipse.nebula.visualization.xygraph.dataprovider.IDataProviderintorg.eclipse.swt.graphics.ColorintintgetName()intintgetRank()The rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes.org.eclipse.nebula.visualization.xygraph.figures.TracegetTrace()org.eclipse.swt.graphics.ColorAn object which may be set by API users to record information about the plot.getXAxis()org.eclipse.january.dataset.IDatasetgetXData()The x data of the plot - might often be indices of y.getYAxis()org.eclipse.january.dataset.IDatasetgetYData()The Y data of the plot, considered as the main data as the x-data might often be indices of y.voidinitialize(IAxis... axes) Initialize with given axesbooleanbooleanbooleanReturn if the Y error is set to draw as an area instead of discrete pointsbooleanbooleanTrue if user trace (normally is)booleanTrue if visiblevoidpointStyleChanged(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) voidrepaint()May be called to refresh the whole graph, for instance if you change trace color, you may need to repaint the legend.voidsetAntiAliasing(boolean antiAliasing) Turn on anti-aliasing of 1D plots here.voidsetAreaAlpha(int areaAlpha) The transparency of areas draw by the trace (for instance in HISTO trace type or FILL trace type).voidsetData(org.eclipse.january.dataset.IDataset xData, org.eclipse.january.dataset.IDataset yData) You may need a repaint after calling thisvoidsetDataName(String dataName) The name of the original data that this trace was plotted from or nullvoidsetDrawYErrorInArea(boolean drawYErrorInArea) Set the Y error to draw as an area instead of discrete pointsvoidsetErrorBarCapWidth(int errorBarCapWidth) voidsetErrorBarColor(org.eclipse.swt.graphics.Color errorBarColor) Color of error bars.voidsetErrorBarEnabled(boolean errorBarEnabled) For 1D tracesvoidsetErrorBarWidth(int errorBarCapWidth) The size of the error bar in pixels not real coordinates.voidsetLineWidth(int lineWidth) The width of line plotted, if trace is a line plot.voidvoidsetPointSize(int pointSize) The size of points plotted if Trace is a Line type.voidsetPointStyle(ILineTrace.PointStyle pointStyle) The style of points if plotted by the trace.voidsetTraceColor(org.eclipse.swt.graphics.Color traceColor) The Color of the tracevoidsetTraceType(ILineTrace.TraceType traceType) Set TraceType.voidsetUserObject(Object userObject) An object which may be set by API users to record information about the plot.voidsetUserTrace(boolean isUserTrace) True if visiblevoidsetVisible(boolean isVisible) True if visiblevoidsetXErrorBarType(ILineTrace.ErrorBarType errorBarType) If showing error bars, sets the y error bar type.voidsetYErrorBarType(ILineTrace.ErrorBarType errorBarType) If showing error bars, sets the y error bar type.toString()voidtraceColorChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.swt.graphics.Color old, org.eclipse.swt.graphics.Color newColor) voidtraceNameChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, String oldName, String newName) voidtraceTypeChanged(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) voidtraceWidthChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, int old, int newWidth) voidtraceYAxisChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, org.eclipse.nebula.visualization.xygraph.figures.Axis oldName, org.eclipse.nebula.visualization.xygraph.figures.Axis newName)
-
Constructor Details
-
LineTraceImpl
public LineTraceImpl()
-
-
Method Details
-
initialize
Description copied from interface:ITraceInitialize with given axes- Specified by:
initializein interfaceITrace- Parameters:
axes-
-
getDataProvider
public org.eclipse.nebula.visualization.xygraph.dataprovider.IDataProvider getDataProvider() -
getTraceType
- Specified by:
getTraceTypein interfaceILineTrace
-
setTraceType
Description copied from interface:ILineTraceSet TraceType. For instance change to a bar plot by calling this.- Specified by:
setTraceTypein interfaceILineTrace- Parameters:
traceType-
-
setTraceColor
public void setTraceColor(org.eclipse.swt.graphics.Color traceColor) Description copied from interface:ILineTraceThe Color of the trace- Specified by:
setTraceColorin interfaceILineTrace- Parameters:
traceColor-
-
getTraceColor
public org.eclipse.swt.graphics.Color getTraceColor()- Specified by:
getTraceColorin interfaceILineTrace
-
getPointStyle
- Specified by:
getPointStylein interfaceILineTrace
-
setPointStyle
Description copied from interface:ILineTraceThe style of points if plotted by the trace.- Specified by:
setPointStylein interfaceILineTrace- Parameters:
pointStyle-
-
setLineWidth
public void setLineWidth(int lineWidth) Description copied from interface:ILineTraceThe width of line plotted, if trace is a line plot.- Specified by:
setLineWidthin interfaceILineTrace- Parameters:
lineWidth-
-
setPointSize
public void setPointSize(int pointSize) Description copied from interface:ILineTraceThe size of points plotted if Trace is a Line type.- Specified by:
setPointSizein interfaceILineTrace- Parameters:
pointSize-
-
setAreaAlpha
public void setAreaAlpha(int areaAlpha) Description copied from interface:ILineTraceThe transparency of areas draw by the trace (for instance in HISTO trace type or FILL trace type).- Specified by:
setAreaAlphain interfaceILineTrace- Parameters:
areaAlpha-
-
setAntiAliasing
public void setAntiAliasing(boolean antiAliasing) Description copied from interface:ILineTraceTurn on anti-aliasing of 1D plots here. No effect on images.- Specified by:
setAntiAliasingin interfaceILineTrace- Parameters:
antiAliasing-
-
setName
- Specified by:
setNamein interfaceorg.eclipse.january.INameable
-
getName
- Specified by:
getNamein interfaceorg.eclipse.january.INameable
-
getPointSize
public int getPointSize()- Specified by:
getPointSizein interfaceILineTrace
-
getAreaAlpha
public int getAreaAlpha()- Specified by:
getAreaAlphain interfaceILineTrace
-
setErrorBarEnabled
public void setErrorBarEnabled(boolean errorBarEnabled) Description copied from interface:ILineTraceFor 1D traces- Specified by:
setErrorBarEnabledin interfaceILineTrace- Parameters:
errorBarEnabled-
-
getYErrorBarType
- Specified by:
getYErrorBarTypein interfaceILineTrace
-
getXErrorBarType
- Specified by:
getXErrorBarTypein interfaceILineTrace
-
setYErrorBarType
Description copied from interface:ILineTraceIf showing error bars, sets the y error bar type. Use setErrorBarEnabled(...) to start showing the error bars.- Specified by:
setYErrorBarTypein interfaceILineTrace- Parameters:
errorBarType-
-
setXErrorBarType
Description copied from interface:ILineTraceIf showing error bars, sets the y error bar type. Use setErrorBarEnabled(...) to start showing the error bars.- Specified by:
setXErrorBarTypein interfaceILineTrace- Parameters:
errorBarType-
-
setErrorBarCapWidth
public void setErrorBarCapWidth(int errorBarCapWidth) -
setErrorBarColor
public void setErrorBarColor(org.eclipse.swt.graphics.Color errorBarColor) Description copied from interface:ILineTraceColor of error bars.- Specified by:
setErrorBarColorin interfaceILineTrace- Parameters:
errorBarColor-
-
getLineWidth
public int getLineWidth()- Specified by:
getLineWidthin interfaceILineTrace
-
getErrorBarCapWidth
public int getErrorBarCapWidth() -
getErrorBarColor
public org.eclipse.swt.graphics.Color getErrorBarColor()- Specified by:
getErrorBarColorin interfaceILineTrace
-
isAntiAliasing
public boolean isAntiAliasing()- Specified by:
isAntiAliasingin interfaceILineTrace
-
isErrorBarEnabled
public boolean isErrorBarEnabled()- Specified by:
isErrorBarEnabledin interfaceILineTrace
-
getData
public org.eclipse.january.dataset.IDataset getData()Description copied from interface:ITraceCall 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. -
getYData
public org.eclipse.january.dataset.IDataset getYData()Description copied from interface:ILineTraceThe Y data of the plot, considered as the main data as the x-data might often be indices of y.- Specified by:
getYDatain interfaceILineTrace- Returns:
-
getXData
public org.eclipse.january.dataset.IDataset getXData()Description copied from interface:ILineTraceThe x data of the plot - might often be indices of y.- Specified by:
getXDatain interfaceILineTrace- Returns:
-
getErrorBarWidth
public int getErrorBarWidth()- Specified by:
getErrorBarWidthin interfaceILineTrace
-
setErrorBarWidth
public void setErrorBarWidth(int errorBarCapWidth) The size of the error bar in pixels not real coordinates.- Specified by:
setErrorBarWidthin interfaceILineTrace- 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:
setDatain interfaceILineTrace- Parameters:
yData-
-
isVisible
public boolean isVisible()Description copied from interface:ITraceTrue if visible -
setVisible
public void setVisible(boolean isVisible) Description copied from interface:ITraceTrue if visible- Specified by:
setVisiblein interfaceITrace
-
repaint
public void repaint()Description copied from interface:ILineTraceMay be called to refresh the whole graph, for instance if you change trace color, you may need to repaint the legend.- Specified by:
repaintin interfaceILineTrace
-
isUserTrace
public boolean isUserTrace()Description copied from interface:ITraceTrue if user trace (normally is)- Specified by:
isUserTracein interfaceITrace- Returns:
-
setUserTrace
public void setUserTrace(boolean isUserTrace) Description copied from interface:ITraceTrue if visible- Specified by:
setUserTracein interfaceITrace
-
getUserObject
Description copied from interface:ITraceAn 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:
getUserObjectin interfaceITrace- Returns:
-
setUserObject
Description copied from interface:ITraceAn 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:
setUserObjectin interfaceITrace
-
toString
-
is3DTrace
public boolean is3DTrace() -
dispose
public void dispose()Description copied from interface:ITraceCalled to release system resources. -
getRank
public int getRank()Description copied from interface:ITraceThe rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes. -
getXAxis
- Specified by:
getXAxisin interfaceILineTrace- Returns:
- The x-axis which this trace is being drawn with
-
getYAxis
- Specified by:
getYAxisin interfaceILineTrace- Returns:
- The y-axis which this trace is being drawn with
-
getDataName
Description copied from interface:ITraceThe name of the original data that this trace was plotted from or null- Specified by:
getDataNamein interfaceITrace- Returns:
-
setDataName
Description copied from interface:ITraceThe name of the original data that this trace was plotted from or null- Specified by:
setDataNamein interfaceITrace
-
traceWidthChanged
public void traceWidthChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, int old, int newWidth) - Specified by:
traceWidthChangedin interfaceorg.eclipse.nebula.visualization.xygraph.figures.ITraceListener
-
traceNameChanged
public void traceNameChanged(org.eclipse.nebula.visualization.xygraph.figures.Trace trace, String oldName, String newName) - Specified by:
traceNameChangedin interfaceorg.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:
traceYAxisChangedin interfaceorg.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:
traceTypeChangedin interfaceorg.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:
pointStyleChangedin interfaceorg.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:
traceColorChangedin interfaceorg.eclipse.nebula.visualization.xygraph.figures.ITraceListener
-
setDrawYErrorInArea
public void setDrawYErrorInArea(boolean drawYErrorInArea) Description copied from interface:ILineTraceSet the Y error to draw as an area instead of discrete points- Specified by:
setDrawYErrorInAreain interfaceILineTrace- Parameters:
drawYErrorInArea-
-
isDrawYErrorInArea
public boolean isDrawYErrorInArea()Description copied from interface:ILineTraceReturn if the Y error is set to draw as an area instead of discrete points- Specified by:
isDrawYErrorInAreain interfaceILineTrace- Returns:
-