Class DAxis
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
org.eclipse.nebula.visualization.xygraph.figures.Axis
org.eclipse.nebula.visualization.xygraph.figures.DAxis
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
,IScaleProvider
public class DAxis extends Axis
The Diamond Light Source implementation of the axis figure.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.figures.Axis
Axis.AxisMouseListener
Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
LinearScale.Orientation
Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
AbstractScale.LabelSide
-
Field Summary
Fields Modifier and Type Field Description protected boolean
userDefinedFormat
the user formatFields inherited from class org.eclipse.nebula.visualization.xygraph.figures.Axis
listeners, ZOOM_RATIO, ZOOM_SPEED
Fields inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
SPACE_BTW_MARK_LABEL
Fields inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
DEFAULT_DATE_FORMAT, default_decimal_format, DEFAULT_ENGINEERING_FORMAT, DEFAULT_LOG_SCALE_MAX, DEFAULT_MAX, DEFAULT_MIN, dirty, ENGINEERING_LIMIT, max, min
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
calculateSpan(java.lang.Object obj)
Calculate span of a textual form of object in scale's orientationvoid
clear()
protected LinearScaleTickLabels
createLinearScaleTickLabels()
Creates the linearScaleTickLabel.protected LinearScaleTickMarks
createLinearScaleTickMarks()
Creates the LinearScaleTickMarks.java.lang.String
format(java.lang.Object obj)
Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.java.lang.String
format(java.lang.Object obj, int extraDP)
Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.protected java.lang.String
getAutoFormat(double min, double max)
int
getMargin()
Margin is half of the label's length(Horizontal Scale) or height(Vertical scale), so that the label can be displayed correctly.double
getScaling()
Get scaling for axis in terms of pixels/unitboolean
hasTicksAtEnds()
Returns true if ticks at end of axis are shownboolean
hasUserDefinedFormat()
boolean
isAxisAutoscaleTight()
boolean
isTicksIndexBased()
protected void
layout()
protected void
layoutTicks()
boolean
performAutoScale(boolean force)
Perform an auto-scale: Axis limits are set to the value range of the traces on this axis.void
setAutoFormat(boolean autoFormat)
void
setAxisAutoscaleTight(boolean axisTight)
void
setDateEnabled(boolean dateEnabled)
void
setFormatPattern(java.lang.String formatPattern)
Sets the format pattern for axis tick label. seeFormat
void
setHasUserDefinedFormat(boolean hasUserDefinedFormat)
Sets whether there is a user defined format or notvoid
setLogScale(boolean enabled)
void
setRange(double lower, double upper)
set the scale rangevoid
setTicksAtEnds(boolean ticksAtEnds)
Sets whether ticks at ends of axis are shownvoid
setTicksIndexBased(boolean isTicksIndexBased)
void
updateTick()
Updates the tick, recalculate all parameters, such as margin, length...Methods inherited from class org.eclipse.nebula.visualization.xygraph.figures.Axis
addListener, addTrace, dataChanged, fireAxisRangeChanged, fireRevalidated, getAutoScale, getAutoScaleThreshold, getForegroundColorRGB, getGrid, getMajorGridColor, getMajorGridColorRGB, getMinorGridColor, getPreferredSize, getScaleFontData, getTitle, getTitleFont, getTitleFontData, getTraceDataRange, getTraceList, getXYGraph, isAutoScale, isDashGridLine, isInverted, isOnPrimarySide, isShowMajorGrid, isShowMinorGrid, isYAxis, paintClientArea, pan, panChecked, removeListener, removeTrace, setAutoScale, setAutoScaleThreshold, setBackgroundColor, setDashGridLine, setFont, setForegroundColor, setGrid, setInverted, setMajorGridColor, setMinorGridColor, setMinorTicksVisible, setPrimarySide, setShowMajorGrid, setShowMinorGrid, setTitle, setTitleFont, setVisible, setXYGraph, setYAxis, setZoomType, toString, zoomInOut
Methods inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
figureLayout, getDimension, getLabel, getLength, getLocalRange, getMargin, getOrientation, getPositionValue, getPositionValue, getScaleRange, getScaleTickLabels, getScaleTickMarks, getTickLength, getTicksProvider, getValuePosition, getValuePrecisePosition, isHorizontal, isLabelCustomised, isPrimary, isShowMaxLabel, isShowMinLabel, setBounds, setLength, setLocalRange, setMargin, setOrientation, setShowMaxLabel, setShowMinLabel, useLocalCoordinates
Methods inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
format, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getRange, getTickLabelSide, getTickLablesSide, getTimeUnit, internalSetAutoFormat, internalSetFormatPattern, internalSetLogScaleEnabled, internalSetRange, isAutoFormat, isDateEnabled, isDirty, isLogScaleEnabled, isMinorTicksVisible, isScaleLineVisible, setDirty, setMajorGridStep, setMajorTickMarkStepHint, setMinorTickMarkStepHint, setRange, setRange, setScaleLineVisible, setTickLabelSide, setTickLableSide, setTimeUnit
Methods inherited from class org.eclipse.draw2d.Figure
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.visualization.xygraph.linearscale.IScaleProvider
format, getFont, getForegroundColor, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getTimeUnit, isAutoFormat, isDateEnabled, isLogScaleEnabled
-
Field Details
-
userDefinedFormat
protected boolean userDefinedFormatthe user format
-
-
Constructor Details
-
Method Details
-
createLinearScaleTickLabels
Description copied from class:LinearScale
Creates the linearScaleTickLabel. To be overridden if necessary if another Axis implementation is used.- Overrides:
createLinearScaleTickLabels
in classLinearScale
-
createLinearScaleTickMarks
Description copied from class:LinearScale
Creates the LinearScaleTickMarks. To be overridden if necessary if another Axis implementation is used.- Overrides:
createLinearScaleTickMarks
in classLinearScale
-
calculateSpan
public int calculateSpan(java.lang.Object obj)Calculate span of a textual form of object in scale's orientation- Parameters:
obj
- object- Returns:
- span in pixel
-
getMargin
public int getMargin()Description copied from class:LinearScale
Margin is half of the label's length(Horizontal Scale) or height(Vertical scale), so that the label can be displayed correctly. So the range and format pattern must be set correctly before you can get the correct margin.- Specified by:
getMargin
in interfaceIScaleProvider
- Overrides:
getMargin
in classLinearScale
- Returns:
- the margin
-
getScaling
public double getScaling()Get scaling for axis in terms of pixels/unit- Returns:
- scaling
-
layout
protected void layout() -
layoutTicks
protected void layoutTicks() -
setTicksIndexBased
public void setTicksIndexBased(boolean isTicksIndexBased)- Parameters:
isTicksIndexBased
- if true, make ticks based on axis dataset indexes
-
isTicksIndexBased
public boolean isTicksIndexBased()- Returns:
- True if ticks are index based
-
format
public java.lang.String format(java.lang.Object obj)Description copied from class:AbstractScale
Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat. This is based on an internal format pattern given the object in parameter.- Specified by:
format
in interfaceIScaleProvider
- Overrides:
format
in classAbstractScale
- Parameters:
obj
- the object- Returns:
- the formatted string
-
updateTick
public void updateTick()Description copied from class:LinearScale
Updates the tick, recalculate all parameters, such as margin, length...- Overrides:
updateTick
in classLinearScale
-
format
public java.lang.String format(java.lang.Object obj, int extraDP)Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat. This is based on an internal format pattern given the object in parameter. When formatting a date, if minOrMaxDate is true as well as autoFormat, then the SimpleDateFormat us used to format the object.- Parameters:
obj
- the objectextraDP
- must be non-negative- Returns:
- the formatted string
-
getAutoFormat
protected java.lang.String getAutoFormat(double min, double max) -
setDateEnabled
public void setDateEnabled(boolean dateEnabled)- Overrides:
setDateEnabled
in classAbstractScale
- Parameters:
dateEnabled
- the dateEnabled to set
-
setFormatPattern
public void setFormatPattern(java.lang.String formatPattern)Description copied from class:AbstractScale
Sets the format pattern for axis tick label. seeFormat
If null is set, default format will be used.
- Overrides:
setFormatPattern
in classAbstractScale
-
setRange
public void setRange(double lower, double upper)Description copied from class:AbstractScale
set the scale range -
setAutoFormat
public void setAutoFormat(boolean autoFormat)- Specified by:
setAutoFormat
in interfaceIScaleProvider
- Overrides:
setAutoFormat
in classAbstractScale
- Parameters:
autoFormat
- the autoFormat to set
-
setLogScale
public void setLogScale(boolean enabled) throws java.lang.IllegalStateException- Overrides:
setLogScale
in classAxis
- Parameters:
enabled
- true if enabling log scales- Throws:
java.lang.IllegalStateException
-
performAutoScale
public boolean performAutoScale(boolean force)Description copied from class:Axis
Perform an auto-scale: Axis limits are set to the value range of the traces on this axis. Includes some optimization: Axis range is set a little wider than exact trace data range. When auto-scale would only perform a minor axis adjustment, axis is left unchanged.- Overrides:
performAutoScale
in classAxis
- Parameters:
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.- Returns:
- true if the axis is repainted due to range change.
- See Also:
Axis.autoScaleThreshold
-
clear
public void clear() -
setAxisAutoscaleTight
public void setAxisAutoscaleTight(boolean axisTight)- Parameters:
axisTight
- set whether autoscale sets axis range tight to the data or the end of axis is set to the nearest tickmark
-
isAxisAutoscaleTight
public boolean isAxisAutoscaleTight()- Returns:
- true if autoscaling axis is tight to displayed data
-
setTicksAtEnds
public void setTicksAtEnds(boolean ticksAtEnds)Sets whether ticks at ends of axis are shown- Parameters:
ticksAtEnds
-
-
hasTicksAtEnds
public boolean hasTicksAtEnds()Returns true if ticks at end of axis are shown- Specified by:
hasTicksAtEnds
in interfaceIScaleProvider
- Overrides:
hasTicksAtEnds
in classLinearScale
- Returns:
- true if ticks at end of axis are shown
-
setHasUserDefinedFormat
public void setHasUserDefinedFormat(boolean hasUserDefinedFormat)Sets whether there is a user defined format or not- Parameters:
hasUserDefinedFormat
-
-
hasUserDefinedFormat
public boolean hasUserDefinedFormat()- Returns:
- true if user format is defined
-