adm
Class CCartesian

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--adm.CCartesian

public class CCartesian
extends java.awt.Panel
implements CConstants

CCartesian is a container widget that holds 1 to 2 traces. It does not implement DeviceListener but receives a trace event from each trace when the new data point is available. The traces in the cartesian plot share one common x-axis (first trace) but not the y-axis. The first trace has a the left side y-axis and the second trace has the right side y-axis. Each trace can have different x-axis range style, y-axis range style, trace style and trace color.

If connected device - property pair contains array of data, the new data points will be plotted and the old points will be erased for each update. Otherwise the specified maximum number of update points (default of 30) will be plotted in the chart. When the next data point is received, the oldest point will be erased from the graph if there is more than maximum number of the data. This number can be reset using setMaxPoint method. The cartesian may have a title if setTitle is called.

Each trace in the plot is defined in the CTrace class. It connects to two device/properties with a simultaneous data update. One is the value of the x-axis and another is the y-axis. Time stamps are used to trigger the trace event. This means that only a data pair with the same time stamp will be sent to CCartesian and plotted on the chart. CTrace defines many trace properties. You may specify one of three axes (x-axis or y-axis) range styles, RANGE_AUTO, RANGE_STATIC, RANGE_FROM_PROPRTY with setRangeStyle. The default range style for all axes are RANGE_FROM_PROPRTY. Call setTraceColor method to reset the default trace color (green) and setTraceStyle to select STYLE_POINT or STYLE_LINE (default) as the trace style. CTrace class also provides setX(Y)DisplayLo(Hi) methods to specify the display range. When any of these methods is called, the range style for that axis will be forced to RANGE_STATIC. If the range style is set to RANGE_STATIC and range low and/or range high are not set, the default display range (0 for low and 100 for high) will be used.

Since:
adm0.4
See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface adm.CConstants
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, AXIS_BOTTOM, AXIS_LEFT, AXIS_RIGHT, AXIS_STYLE_LINEAR, AXIS_STYLE_LOG10, AXIS_TOP, CLASS_QUERY, CLRMOD_ALARM, CLRMOD_STATIC, COLUMN, DEVICE_QUERY, DIR_DOWN, DIR_LEFT, DIR_RIGHT, DIR_UP, FILL_FROM_CENTER, FILL_FROM_EDGE, FRMT_AUTO, FRMT_FLOAT, FRMT_HEX, FRMT_INTEGER, FRMT_OCTAL, FRMT_SCIENTIFIC, HORIZONTAL, LABEL_ALL, LABEL_AXIS, LABEL_NONE, LABEL_VALUE, PROPERTY_QUERY, RANGE_AUTO, RANGE_FROM_PROPERTY, RANGE_STATIC, ROW, STYLE_FILLUNDER, STYLE_LINE, STYLE_POINT, VERTICAL
 
Constructor Summary
CCartesian()
          Null Constructor
CCartesian(CTrace trace)
          Constructor with parameters
CCartesian(CTrace trace1, CTrace trace2)
          Constructor with parameters
 
Method Summary
 java.awt.Component add(CTrace trace)
          Overwrite container's add method for Viual tools
 void addTrace(CTrace trace)
          Add trace to the cartesian plot.
 int getMaxPoint()
          Return max point shown in the plot
 java.lang.String getTitle()
          Return the title string.
 void paint(java.awt.Graphics g)
           
 void setBounds(int x, int y, int w, int h)
          Over write the parant setBounds method to force draw the background again when user resize the widget
 void setMaxPoint(int num)
          Set up max data point shown in the plot.
 void setSize(int w, int h)
          Over write the parant setSize method to force draw the background again when user resize the widget
 void setTitle(java.lang.String aTitle)
          Set up the title string appear on the top of the plot.
 void setTrace(int which, CTrace newTrace)
          Add a new trace to plot.
 void update(java.awt.Graphics g)
          Over write the Canvas.update to only call this.paint (this is necessary since the Canvas.update will erase the background)
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CCartesian

public CCartesian()
Null Constructor

CCartesian

public CCartesian(CTrace trace)
Constructor with parameters

CCartesian

public CCartesian(CTrace trace1,
                  CTrace trace2)
Constructor with parameters
Method Detail

setTrace

public void setTrace(int which,
                     CTrace newTrace)
Add a new trace to plot. The Y axis of the new trace is left if which is 0 and right if which is 1.

addTrace

public void addTrace(CTrace trace)
Add trace to the cartesian plot.

add

public java.awt.Component add(CTrace trace)
Overwrite container's add method for Viual tools

setTitle

public void setTitle(java.lang.String aTitle)
Set up the title string appear on the top of the plot. Default is null (noe title).

getTitle

public java.lang.String getTitle()
Return the title string. There is no title if it is null.

setMaxPoint

public void setMaxPoint(int num)
Set up max data point shown in the plot. When tha data points is more than the max point, the oldest point will be erased.

getMaxPoint

public int getMaxPoint()
Return max point shown in the plot

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Over write the parant setBounds method to force draw the background again when user resize the widget
Overrides:
setBounds in class java.awt.Component

setSize

public void setSize(int w,
                    int h)
Over write the parant setSize method to force draw the background again when user resize the widget
Overrides:
setSize in class java.awt.Component

update

public final void update(java.awt.Graphics g)
Over write the Canvas.update to only call this.paint (this is necessary since the Canvas.update will erase the background)
Overrides:
update in class java.awt.Container

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container