Class XYGraph
- java.lang.Object
-
- org.eclipse.draw2d.Figure
-
- org.eclipse.nebula.visualization.xygraph.figures.XYGraph
-
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure,IXYGraph
public class XYGraph extends org.eclipse.draw2d.Figure implements IXYGraph
This class is the main figure for the plotting. It contains a PlotArea, which contains a space to plot traces, and the axes, title and legend of the graph. XY-Graph Figure.
-
-
Field Summary
Fields Modifier and Type Field Description private java.beans.PropertyChangeSupportchangeSupportAdd property change support to XYGraph Use for inform listener of xyGraphMem property changedstatic org.eclipse.swt.graphics.RGB[]DEFAULT_TRACES_COLORDefault colors for newly added item, used over when reaching the end.private static intGAPprotected java.util.Map<Axis,Legend>legendMapprotected OperationsManageroperationsManagerprotected PlotAreaplotAreaAxisprimaryXAxisDeprecated.AxisprimaryYAxisDeprecated.static java.lang.StringPROPERTY_CONFIGDeprecated.static java.lang.StringPROPERTY_XY_GRAPH_MEMDeprecated.static java.lang.StringPROPERTY_ZOOMTYPEDeprecated.private booleanshowLegendprivate java.lang.StringtitleGraph title.private org.eclipse.swt.graphics.ColortitleColorprivate org.eclipse.swt.graphics.RGBtitleColorRgbprivate org.eclipse.swt.graphics.FontDatatitleFontDataprotected org.eclipse.draw2d.LabeltitleLabelprotected booleantransparentprotected java.util.List<Axis>xAxisListprivate XYGraphMementoxyGraphMemSave the Graph settings Send a property changed event when changedprotected java.util.List<Axis>yAxisListprivate ZoomTypezoomType
-
Constructor Summary
Constructors Constructor Description XYGraph()ConstructorXYGraph(IAxesFactory axesFactory)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(Annotation annotation)Add an annotationvoidaddAxis(Axis axis)Add an axis to the graphvoidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)voidaddTrace(Trace trace)Add a traceprotected PlotAreacreatePlotArea(IXYGraph xyGraph)Warning: This method is called in the constructor to create a plot areavoidfireConfigChanged()java.util.List<Axis>getAxisList()org.eclipse.swt.graphics.ImagegetImage()org.eclipse.swt.graphics.ImagegetImage(org.eclipse.swt.graphics.Rectangle size)LegendgetLegend(Trace trace)java.util.Map<Axis,Legend>getLegendMap()OperationsManagergetOperationsManager()PlotAreagetPlotArea()AxisgetPrimaryXAxis()AxisgetPrimaryYAxis()java.lang.StringgetTitle()org.eclipse.swt.graphics.ColorgetTitleColor()org.eclipse.swt.graphics.RGBgetTitleColorRgb()org.eclipse.swt.graphics.FontgetTitleFont()org.eclipse.swt.graphics.FontDatagetTitleFontData()java.util.List<Axis>getXAxisList()XYGraphMementogetXyGraphMem()java.util.List<Axis>getYAxisList()ZoomTypegetZoomType()booleanisOpaque()booleanisShowLegend()booleanisShowTitle()booleanisTransparent()protected voidlayout()voidpaintFigure(org.eclipse.draw2d.Graphics graphics)voidperformAutoScale()Perform forced autoscale to all axes.voidperformStagger()Stagger all axes: Autoscale each axis so that traces on various axes don't overlapvoidremoveAnnotation(Annotation annotation)Remove an annotationbooleanremoveAxis(Axis axis)Remove an axis from the graphvoidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)voidremoveTrace(Trace trace)Remove a trace.voidsetShowLegend(boolean showLegend)voidsetShowTitle(boolean showTitle)voidsetTitle(java.lang.String title)voidsetTitleColor(org.eclipse.swt.graphics.Color titleColor)voidsetTitleFont(org.eclipse.swt.graphics.Font titleFont)voidsetTransparent(boolean transparent)voidsetXyGraphMem(XYGraphMemento xyGraphMem)voidsetZoomType(ZoomType zoomType)-
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
-
-
-
-
Field Detail
-
PROPERTY_CONFIG
@Deprecated public static final java.lang.String PROPERTY_CONFIG
Deprecated.UseIXYGraph.PROPERTY_CONFIGinstead- See Also:
- Constant Field Values
-
PROPERTY_XY_GRAPH_MEM
@Deprecated public static final java.lang.String PROPERTY_XY_GRAPH_MEM
Deprecated.UseIXYGraph.PROPERTY_XY_GRAPH_MEMinstead- See Also:
- Constant Field Values
-
PROPERTY_ZOOMTYPE
@Deprecated public static final java.lang.String PROPERTY_ZOOMTYPE
Deprecated.UseIXYGraph.PROPERTY_ZOOMTYPEinstead- See Also:
- Constant Field Values
-
changeSupport
private java.beans.PropertyChangeSupport changeSupport
Add property change support to XYGraph Use for inform listener of xyGraphMem property changed
-
xyGraphMem
private XYGraphMemento xyGraphMem
Save the Graph settings Send a property changed event when changed
-
GAP
private static final int GAP
- See Also:
- Constant Field Values
-
DEFAULT_TRACES_COLOR
public static final org.eclipse.swt.graphics.RGB[] DEFAULT_TRACES_COLOR
Default colors for newly added item, used over when reaching the end.Very hard to find a long list of distinct colors. This list is definitely too short...
-
transparent
protected boolean transparent
-
showLegend
private boolean showLegend
-
title
private java.lang.String title
Graph title. Should never benullbecause otherwise the ToolbarArmedXYGraph's GraphConfigPage can crash.
-
titleColor
private org.eclipse.swt.graphics.Color titleColor
-
titleLabel
protected org.eclipse.draw2d.Label titleLabel
-
titleFontData
private org.eclipse.swt.graphics.FontData titleFontData
-
titleColorRgb
private org.eclipse.swt.graphics.RGB titleColorRgb
-
xAxisList
protected java.util.List<Axis> xAxisList
-
yAxisList
protected java.util.List<Axis> yAxisList
-
plotArea
protected PlotArea plotArea
-
primaryXAxis
@Deprecated public final Axis primaryXAxis
Deprecated.UsegetPrimaryXAxis()instead
-
primaryYAxis
@Deprecated public final Axis primaryYAxis
Deprecated.UsegetPrimaryYAxis()instead
-
operationsManager
protected OperationsManager operationsManager
-
zoomType
private ZoomType zoomType
-
-
Constructor Detail
-
XYGraph
public XYGraph()
Constructor
-
XYGraph
public XYGraph(IAxesFactory axesFactory)
Constructor.- Parameters:
axesFactory- TheIAxesFactoryto use to create the primary axes for the graph. Should not benull
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
addPropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addPropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
addPropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addPropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
removePropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removePropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
removePropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removePropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
fireConfigChanged
public void fireConfigChanged()
- Specified by:
fireConfigChangedin interfaceIXYGraph
-
getXyGraphMem
public XYGraphMemento getXyGraphMem()
- Specified by:
getXyGraphMemin interfaceIXYGraph
-
setXyGraphMem
public void setXyGraphMem(XYGraphMemento xyGraphMem)
- Specified by:
setXyGraphMemin interfaceIXYGraph
-
createPlotArea
protected PlotArea createPlotArea(IXYGraph xyGraph)
Warning: This method is called in the constructor to create a plot area- Parameters:
xyGraph-- Returns:
- a plotArea
-
isOpaque
public boolean isOpaque()
- Specified by:
isOpaquein interfaceorg.eclipse.draw2d.IFigure- Overrides:
isOpaquein classorg.eclipse.draw2d.Figure
-
layout
protected void layout()
- Overrides:
layoutin classorg.eclipse.draw2d.Figure
-
setZoomType
public void setZoomType(ZoomType zoomType)
- Specified by:
setZoomTypein interfaceIXYGraph- Parameters:
zoomType- the zoomType to set
-
getZoomType
public ZoomType getZoomType()
- Specified by:
getZoomTypein interfaceIXYGraph- Returns:
- the zoomType
-
setTitle
public void setTitle(java.lang.String title)
-
setShowTitle
public void setShowTitle(boolean showTitle)
- Specified by:
setShowTitlein interfaceIXYGraph- Parameters:
showTitle- true if title should be shown; false otherwise.
-
isShowTitle
public boolean isShowTitle()
- Specified by:
isShowTitlein interfaceIXYGraph- Returns:
- true if title should be shown; false otherwise.
-
setShowLegend
public void setShowLegend(boolean showLegend)
- Specified by:
setShowLegendin interfaceIXYGraph- Parameters:
showLegend- true if legend should be shown; false otherwise.
-
isShowLegend
public boolean isShowLegend()
- Specified by:
isShowLegendin interfaceIXYGraph- Returns:
- the showLegend
-
addAxis
public void addAxis(Axis axis)
Add an axis to the graph
-
removeAxis
public boolean removeAxis(Axis axis)
Remove an axis from the graph- Specified by:
removeAxisin interfaceIXYGraph- Parameters:
axis-- Returns:
- true if this axis exists.
-
addTrace
public void addTrace(Trace trace)
Add a trace
-
removeTrace
public void removeTrace(Trace trace)
Remove a trace.- Specified by:
removeTracein interfaceIXYGraph- Parameters:
trace-
-
addAnnotation
public void addAnnotation(Annotation annotation)
Add an annotation- Specified by:
addAnnotationin interfaceIXYGraph- Parameters:
annotation-
-
removeAnnotation
public void removeAnnotation(Annotation annotation)
Remove an annotation- Specified by:
removeAnnotationin interfaceIXYGraph- Parameters:
annotation-
-
setTitleFont
public void setTitleFont(org.eclipse.swt.graphics.Font titleFont)
- Specified by:
setTitleFontin interfaceIXYGraph- Parameters:
titleFont- the titleFont to set
-
getTitleFont
public org.eclipse.swt.graphics.Font getTitleFont()
- Specified by:
getTitleFontin interfaceIXYGraph- Returns:
- the title font.
-
getTitleFontData
public org.eclipse.swt.graphics.FontData getTitleFontData()
- Specified by:
getTitleFontDatain interfaceIXYGraph
-
setTitleColor
public void setTitleColor(org.eclipse.swt.graphics.Color titleColor)
- Specified by:
setTitleColorin interfaceIXYGraph- Parameters:
titleColor- the titleColor to set
-
paintFigure
public void paintFigure(org.eclipse.draw2d.Graphics graphics)
- Specified by:
paintFigurein interfaceIXYGraph- Overrides:
paintFigurein classorg.eclipse.draw2d.Figure
-
setTransparent
public void setTransparent(boolean transparent)
- Specified by:
setTransparentin interfaceIXYGraph- Parameters:
transparent- the transparent to set
-
isTransparent
public boolean isTransparent()
- Specified by:
isTransparentin interfaceIXYGraph- Returns:
- the transparent
-
getPlotArea
public PlotArea getPlotArea()
- Specified by:
getPlotAreain interfaceIXYGraph- Returns:
- the plotArea, which contains all the elements drawn inside it.
-
getImage
public org.eclipse.swt.graphics.Image getImage()
-
getTitleColor
public org.eclipse.swt.graphics.Color getTitleColor()
- Specified by:
getTitleColorin interfaceIXYGraph- Returns:
- the titleColor
-
getTitleColorRgb
public org.eclipse.swt.graphics.RGB getTitleColorRgb()
- Specified by:
getTitleColorRgbin interfaceIXYGraph
-
getTitle
public java.lang.String getTitle()
-
getOperationsManager
public OperationsManager getOperationsManager()
- Specified by:
getOperationsManagerin interfaceIXYGraph- Returns:
- the operationsManager
-
getXAxisList
public java.util.List<Axis> getXAxisList()
- Specified by:
getXAxisListin interfaceIXYGraph- Returns:
- the xAxisList
-
getYAxisList
public java.util.List<Axis> getYAxisList()
- Specified by:
getYAxisListin interfaceIXYGraph- Returns:
- the yAxisList
-
getAxisList
public java.util.List<Axis> getAxisList()
- Specified by:
getAxisListin interfaceIXYGraph- Returns:
- the all the axis include xAxes and yAxes. yAxisList is appended to xAxisList in the returned list.
-
getLegendMap
public java.util.Map<Axis,Legend> getLegendMap()
- Specified by:
getLegendMapin interfaceIXYGraph- Returns:
- the legendMap
-
performAutoScale
public void performAutoScale()
Perform forced autoscale to all axes.- Specified by:
performAutoScalein interfaceIXYGraph
-
performStagger
public void performStagger()
Stagger all axes: Autoscale each axis so that traces on various axes don't overlap- Specified by:
performStaggerin interfaceIXYGraph
-
getImage
public org.eclipse.swt.graphics.Image getImage(org.eclipse.swt.graphics.Rectangle size)
- Parameters:
trim- a SWT Rectangle- Returns:
- Image of the XYFigure. Receiver must dispose.
-
getPrimaryXAxis
public Axis getPrimaryXAxis()
- Specified by:
getPrimaryXAxisin interfaceIXYGraph
-
getPrimaryYAxis
public Axis getPrimaryYAxis()
- Specified by:
getPrimaryYAxisin interfaceIXYGraph
-
-