public class Axis extends LinearScale
Modifier and Type | Class and Description |
---|---|
(package private) class |
Axis.AxisMouseListener
Listener to mouse events, performs panning and some zooms Is very similar
to the PlotMouseListener, but unclear how easy/useful it would be to base
them on the same code.
|
LinearScale.Orientation
AbstractScale.LabelSide
Modifier and Type | Field and Description |
---|---|
protected java.util.List<IAxisListener> |
listeners |
(package private) static double |
ZOOM_RATIO
The ratio of the shrink/expand area for one zoom.
|
(package private) static int |
ZOOM_SPEED
The auto zoom interval in ms.
|
SPACE_BTW_MARK_LABEL
DEFAULT_DATE_FORMAT, default_decimal_format, DEFAULT_ENGINEERING_FORMAT, DEFAULT_LOG_SCALE_MAX, DEFAULT_MAX, DEFAULT_MIN, dirty, ENGINEERING_LIMIT, max, min
Constructor and Description |
---|
Axis(java.lang.String title,
boolean yAxis)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(IAxisListener listener) |
void |
addTrace(Trace trace)
Add a trace to the axis.
|
void |
dataChanged(IDataProvider dataProvider) |
protected void |
fireAxisRangeChanged(Range old_range,
Range new_range) |
protected void |
fireRevalidated() |
boolean |
getAutoScale() |
double |
getAutoScaleThreshold() |
org.eclipse.swt.graphics.RGB |
getForegroundColorRGB() |
Grid |
getGrid() |
org.eclipse.swt.graphics.Color |
getMajorGridColor() |
org.eclipse.swt.graphics.RGB |
getMajorGridColorRGB() |
org.eclipse.swt.graphics.Color |
getMinorGridColor() |
org.eclipse.draw2d.geometry.Dimension |
getPreferredSize(int wHint,
int hHint) |
org.eclipse.swt.graphics.FontData |
getScaleFontData() |
java.lang.String |
getTitle() |
org.eclipse.swt.graphics.Font |
getTitleFont() |
org.eclipse.swt.graphics.FontData |
getTitleFontData() |
Range |
getTraceDataRange() |
protected java.util.List<Trace> |
getTraceList() |
IXYGraph |
getXYGraph() |
boolean |
isAutoScale() |
boolean |
isDashGridLine() |
boolean |
isInverted()
Returns True if axis is inverted, False otherwise
|
boolean |
isOnPrimarySide() |
boolean |
isShowMajorGrid() |
boolean |
isShowMinorGrid() |
boolean |
isYAxis() |
protected void |
layout() |
protected void |
paintClientArea(org.eclipse.draw2d.Graphics graphics) |
protected void |
pan(Range temp,
double t1,
double t2)
Pan the axis
|
protected boolean |
panChecked(Range temp,
double t1,
double t2)
Pan the axis and check if new range is okay
|
boolean |
performAutoScale(boolean force)
Perform an auto-scale: Axis limits are set to the value range of the
traces on this axis.
|
boolean |
removeListener(IAxisListener listener) |
boolean |
removeTrace(Trace trace)
Remove a trace from the axis.
|
void |
setAutoScale(boolean autoScale) |
void |
setAutoScaleThreshold(double autoScaleThreshold)
The autoScaleThreshold must be a value in range [0,1], which represents a
percentage of the plot area for the threshold when autoScale is
performed.The autoScale will performed only if the spare space exceeds
this threshold.
|
void |
setBackgroundColor(org.eclipse.swt.graphics.Color bg) |
void |
setDashGridLine(boolean dashGridLine) |
void |
setFont(org.eclipse.swt.graphics.Font font) |
void |
setForegroundColor(org.eclipse.swt.graphics.Color color) |
void |
setGrid(Grid grid) |
void |
setInverted(boolean isInverted)
Inverts the axis if set to True
|
void |
setLogScale(boolean enabled) |
void |
setMajorGridColor(org.eclipse.swt.graphics.Color majorGridColor) |
void |
setMinorGridColor(org.eclipse.swt.graphics.Color minorGridColor) |
void |
setMinorTicksVisible(boolean minorTicksVisible) |
void |
setPrimarySide(boolean onPrimarySide)
Set the axis on primary side (Bottom/Left) or secondary side (Top/Right).
|
void |
setRange(double lower,
double upper)
set the scale range
|
void |
setShowMajorGrid(boolean showMajorGrid) |
void |
setShowMinorGrid(boolean showMinorGrid) |
void |
setTitle(java.lang.String title) |
void |
setTitleFont(org.eclipse.swt.graphics.Font titleFont) |
void |
setVisible(boolean visible) |
void |
setXYGraph(IXYGraph xyGraph) |
void |
setYAxis(boolean isYAxis)
Set this axis as Y-Axis or X-Axis.
|
void |
setZoomType(ZoomType zoomType) |
java.lang.String |
toString() |
void |
zoomInOut(double center,
double factor)
Zoom axis
|
createLinearScaleTickLabels, createLinearScaleTickMarks, figureLayout, getDimension, getLabel, getLength, getLocalRange, getMargin, getMargin, getOrientation, getPositionValue, getPositionValue, getScaleRange, getScaleTickLabels, getScaleTickMarks, getTickLength, getTicksProvider, getValuePosition, getValuePrecisePosition, hasTicksAtEnds, isHorizontal, isLabelCustomised, isPrimary, isShowMaxLabel, isShowMinLabel, setBounds, setLength, setLocalRange, setMargin, setOrientation, setShowMaxLabel, setShowMinLabel, updateTick, useLocalCoordinates
format, format, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getRange, getTickLabelSide, getTickLablesSide, getTimeUnit, internalSetAutoFormat, internalSetFormatPattern, internalSetLogScaleEnabled, internalSetRange, isAutoFormat, isDateEnabled, isDirty, isLogScaleEnabled, isMinorTicksVisible, isScaleLineVisible, setAutoFormat, setDateEnabled, setDirty, setFormatPattern, setMajorGridStep, setMajorTickMarkStepHint, setMinorTickMarkStepHint, setRange, setRange, setScaleLineVisible, setTickLabelSide, setTickLableSide, setTimeUnit
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, 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, 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, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
format, format, getFont, getForegroundColor, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getTimeUnit, isAutoFormat, isDateEnabled, isLogScaleEnabled, setAutoFormat
static final double ZOOM_RATIO
static final int ZOOM_SPEED
protected final java.util.List<IAxisListener> listeners
public Axis(java.lang.String title, boolean yAxis)
title
- title of the axisyAxis
- true if this is the Y-Axis, false if this is the X-Axis.public void setFont(org.eclipse.swt.graphics.Font font)
setFont
in interface org.eclipse.draw2d.IFigure
setFont
in class LinearScale
public org.eclipse.swt.graphics.FontData getTitleFontData()
public org.eclipse.swt.graphics.FontData getScaleFontData()
public void addListener(IAxisListener listener)
public boolean removeListener(IAxisListener listener)
protected void fireRevalidated()
public void setRange(double lower, double upper)
AbstractScale
setRange
in class AbstractScale
lower
- the lower limitupper
- the upper limitpublic void setInverted(boolean isInverted)
isInverted
- public boolean isInverted()
protected void layout()
layout
in class LinearScale
public void setVisible(boolean visible)
setVisible
in interface org.eclipse.draw2d.IFigure
setVisible
in class org.eclipse.draw2d.Figure
public void setForegroundColor(org.eclipse.swt.graphics.Color color)
setForegroundColor
in interface org.eclipse.draw2d.IFigure
setForegroundColor
in class LinearScale
public void setMinorTicksVisible(boolean minorTicksVisible)
setMinorTicksVisible
in class AbstractScale
minorTicksVisible
- the minorTicksVisible to setpublic org.eclipse.swt.graphics.RGB getForegroundColorRGB()
public void setBackgroundColor(org.eclipse.swt.graphics.Color bg)
setBackgroundColor
in interface org.eclipse.draw2d.IFigure
setBackgroundColor
in class org.eclipse.draw2d.Figure
public org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint, int hHint)
getPreferredSize
in interface org.eclipse.draw2d.IFigure
getPreferredSize
in class LinearScale
protected void paintClientArea(org.eclipse.draw2d.Graphics graphics)
paintClientArea
in class org.eclipse.draw2d.Figure
public Range getTraceDataRange()
null
if there is no trace
data.public boolean performAutoScale(boolean force)
force
- If true, the axis will be auto-scaled by force regardless the
autoScale field. Otherwise, it will use the autoScale field to
judge whether an auto-scale will be performed.autoScaleThreshold
public void addTrace(Trace trace)
trace
- the trace to be added.public boolean removeTrace(Trace trace)
trace
- public void setTitle(java.lang.String title)
title
- the title to setpublic java.lang.String getTitle()
public boolean isAutoScale()
public void setAutoScale(boolean autoScale)
autoScale
- the autoScale to setpublic boolean isShowMajorGrid()
public void setShowMajorGrid(boolean showMajorGrid)
showMajorGrid
- the showMajorGrid to setpublic boolean isShowMinorGrid()
public void setShowMinorGrid(boolean showMinorGrid)
showMinorGrid
- the showMinorGrid to setpublic org.eclipse.swt.graphics.Color getMajorGridColor()
public void setMajorGridColor(org.eclipse.swt.graphics.Color majorGridColor)
majorGridColor
- the majorGridColor to setpublic org.eclipse.swt.graphics.RGB getMajorGridColorRGB()
public org.eclipse.swt.graphics.Color getMinorGridColor()
public void setMinorGridColor(org.eclipse.swt.graphics.Color minorGridColor)
minorGridColor
- the minorGridColor to setpublic void setTitleFont(org.eclipse.swt.graphics.Font titleFont)
titleFont
- the titleFont to setpublic boolean isDashGridLine()
public void setDashGridLine(boolean dashGridLine)
dashGridLine
- the dashGridLine to setpublic void setXYGraph(IXYGraph xyGraph)
xyGraph
- the xyGraph to setpublic IXYGraph getXYGraph()
protected java.util.List<Trace> getTraceList()
public java.lang.String toString()
toString
in class java.lang.Object
public void dataChanged(IDataProvider dataProvider)
public void setAutoScaleThreshold(double autoScaleThreshold)
autoScaleThreshold
- the autoScaleThreshold to setpublic void setZoomType(ZoomType zoomType)
zoomType
- the zoomType to setpublic org.eclipse.swt.graphics.Font getTitleFont()
public double getAutoScaleThreshold()
public boolean getAutoScale()
public void setYAxis(boolean isYAxis)
isYAxis
- set true if the axis is Y-Axis; false if it is X-Axis.public void setPrimarySide(boolean onPrimarySide)
onPrimarySide
- set true if the axis on primary side(Bottom/Left); false if it
is not on the primary side of xy graph(Top/Right).public boolean isYAxis()
public boolean isOnPrimarySide()
protected void pan(Range temp, double t1, double t2)
temp
- Original axis range before the panning startedt1
- Start of the panning movet2
- End of the panning moveprotected boolean panChecked(Range temp, double t1, double t2)
temp
- Original axis range before the panning startedt1
- Start of the panning movet2
- End of the panning movepublic void zoomInOut(double center, double factor)
center
- Axis position at the 'center' of the zoomfactor
- Zoom factor. Positive to zoom 'in', negative 'out'.public void setGrid(Grid grid)
grid
- the grid to setpublic Grid getGrid()
public void setLogScale(boolean enabled) throws java.lang.IllegalStateException
setLogScale
in class AbstractScale
enabled
- true if enabling log scalesjava.lang.IllegalStateException