Class AspectAxis

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
org.dawnsci.plotting.draw2d.swtxy.AspectAxis
All Implemented Interfaces:
IAxis, org.eclipse.draw2d.IFigure, org.eclipse.nebula.visualization.xygraph.linearscale.IScaleProvider

public class AspectAxis extends org.eclipse.nebula.visualization.xygraph.figures.DAxis implements IAxis
An axis which can keep aspect with another and have a maximum possible extend which cannot be altered.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale

    org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale.Orientation

    Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale

    org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale.LabelSide

    Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

    org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch

    Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

    org.eclipse.draw2d.IFigure.NoInsets
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class org.eclipse.nebula.visualization.xygraph.figures.DAxis

    userDefinedFormat

    Fields inherited from class org.eclipse.nebula.visualization.xygraph.figures.Axis

    listeners

    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

    Fields inherited from class org.eclipse.draw2d.Figure

    bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip

    Fields inherited from interface org.eclipse.draw2d.IFigure

    MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
  • Constructor Summary

    Constructors
    Constructor
    Description
    AspectAxis(String title, boolean yAxis)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a listener notified when the axis changes.
    void
    checkBounds(boolean zooming)
     
    protected void
    fireAxisRangeChanged(org.eclipse.nebula.visualization.xygraph.linearscale.Range old_range, org.eclipse.nebula.visualization.xygraph.linearscale.Range new_range)
     
    protected void
     
    protected String
    getAutoFormat(double min, double max)
     
     
    double
    getLabel(double value)
    Override to provide custom axis labels.
    double
    returns the lower bound in the units of the axis (not pixels)
    org.eclipse.nebula.visualization.xygraph.linearscale.Range
     
    double
    getPositionFromValue(double value)
    The position in pixels of a given value.
    double
    getPositionValue(int position)
    The value for a position in pixels.
    int
     
    double
    returns the upper bound in the units of the axis (not pixels)
    double
    getValueFromPosition(double position)
    The value for a position in pixels.
    int
    getValuePosition(double value)
    The position in pixels of a given value.
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    protected void
    paintClientArea(org.eclipse.draw2d.Graphics graphics)
     
    protected boolean
    panChecked(org.eclipse.nebula.visualization.xygraph.linearscale.Range temp, double t1, double t2)
     
    void
    Add a listener notified when the axis changes.
    void
    setAutoscale(boolean autoscale)
     
    void
    setDateFormatEnabled(boolean dateEnabled)
    Sets if the date format should be formatting this axis.
    void
    setForegroundColor(org.eclipse.swt.graphics.Color color)
     
    void
    setKeepAspect(boolean keepAspect)
     
    void
     
    void
    setLabelDataAndTitle(org.eclipse.january.dataset.IDataset labels)
    Sets an alternative dataset to use for the labels and the title
    void
    setLog10(boolean isLog10)
     
    void
    setMaximumRange(double lower, double upper)
    Call to set a maximum range for the axis
    void
    setMaximumRange(org.eclipse.nebula.visualization.xygraph.linearscale.Range maximumRange)
    Set with lowerinvalid input: '<'upper, the class will check for if the axis is in reversed mode.
    void
    setRange(double lower, double upper)
    Sets the range of the axis, start maybe > end for reversed axes.
    void
     
    void
    setUseAspectFromLabel(boolean useAspectFromLabel)
     
     
    void
    zoomInOut(double center, double factor)
     

    Methods inherited from class org.eclipse.nebula.visualization.xygraph.figures.DAxis

    calculateSpan, clear, createLinearScaleTickLabels, createLinearScaleTickMarks, format, format, getMargin, getScaling, hasTicksAtEnds, hasUserDefinedFormat, isAxisAutoscaleTight, isTicksIndexBased, layout, layoutTicks, performAutoScale, setAutoFormat, setAxisAutoscaleTight, setDateEnabled, setFormatPattern, setHasUserDefinedFormat, setLogScale, setTicksAtEnds, setTicksIndexBased, updateTick

    Methods inherited from class org.eclipse.nebula.visualization.xygraph.figures.Axis

    addListener, addTrace, dataChanged, getAutoScale, getAutoScaleThreshold, getForegroundColorRGB, getGrid, getMajorGridColor, getMajorGridColorRGB, getMinorGridColor, getPreferredSize, getScaleFontData, getTitle, getTitleFont, getTitleFontData, getTraceDataRange, getTraceList, getXYGraph, isAutoScale, isDashGridLine, isInverted, isOnPrimarySide, isShowMajorGrid, isShowMinorGrid, isYAxis, pan, removeListener, removeTrace, setAutoScale, setAutoScaleThreshold, setBackgroundColor, setDashGridLine, setFont, setGrid, setInverted, setMajorGridColor, setMinorGridColor, setMinorTicksVisible, setPrimarySide, setShowMajorGrid, setShowMinorGrid, setTitleFont, setVisible, setXYGraph, setYAxis, setZoomType

    Methods inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale

    figureLayout, getDimension, getLength, getLocalRange, getMargin, getOrientation, getPositionValue, getPositionValue, getScaleRange, getScaleTickLabels, getScaleTickMarks, getTickLength, getTicksProvider, getValuePosition, getValuePrecisePosition, isHorizontal, 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, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getTimeUnit, isAutoFormat, isDateEnabled, isLogScaleEnabled
  • Field Details

  • Constructor Details

    • AspectAxis

      public AspectAxis(String title, boolean yAxis)
  • Method Details

    • setTitle

      public void setTitle(String title)
      Specified by:
      setTitle in interface IAxis
      Overrides:
      setTitle in class org.eclipse.nebula.visualization.xygraph.figures.Axis
      Parameters:
      title -
    • setForegroundColor

      public void setForegroundColor(org.eclipse.swt.graphics.Color color)
      Specified by:
      setForegroundColor in interface IAxis
      Specified by:
      setForegroundColor in interface org.eclipse.draw2d.IFigure
      Overrides:
      setForegroundColor in class org.eclipse.nebula.visualization.xygraph.figures.Axis
      Parameters:
      color -
    • setKeepAspectWith

      public void setKeepAspectWith(AspectAxis axis)
    • getPrecheckTickLength

      public int getPrecheckTickLength()
      Returns:
      tick length before axis has been resized after checkBounds
    • getDirection

      public String getDirection()
    • checkBounds

      public void checkBounds(boolean zooming)
    • zoomInOut

      public void zoomInOut(double center, double factor)
      Overrides:
      zoomInOut in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • paintClientArea

      protected void paintClientArea(org.eclipse.draw2d.Graphics graphics)
      Overrides:
      paintClientArea in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • panChecked

      protected boolean panChecked(org.eclipse.nebula.visualization.xygraph.linearscale.Range temp, double t1, double t2)
      Overrides:
      panChecked in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • isKeepAspect

      public boolean isKeepAspect()
    • setAutoscale

      public void setAutoscale(boolean autoscale)
      Specified by:
      setAutoscale in interface IAxis
    • setKeepAspect

      public void setKeepAspect(boolean keepAspect)
    • isUseAspectFromLabel

      public boolean isUseAspectFromLabel()
    • setUseAspectFromLabel

      public void setUseAspectFromLabel(boolean useAspectFromLabel)
    • getMaximumRange

      public org.eclipse.nebula.visualization.xygraph.linearscale.Range getMaximumRange()
    • setMaximumRange

      public void setMaximumRange(double lower, double upper)
      Description copied from interface: IAxis
      Call to set a maximum range for the axis
      Specified by:
      setMaximumRange in interface IAxis
    • setMaximumRange

      public void setMaximumRange(org.eclipse.nebula.visualization.xygraph.linearscale.Range maximumRange)
      Set with lowerinvalid input: '<'upper, the class will check for if the axis is in reversed mode.
      Parameters:
      maximumRange -
    • setRange

      public void setRange(double lower, double upper)
      Description copied from interface: IAxis
      Sets the range of the axis, start maybe > end for reversed axes.
      Specified by:
      setRange in interface IAxis
      Overrides:
      setRange in class org.eclipse.nebula.visualization.xygraph.figures.DAxis
      Parameters:
      lower -
      upper -
    • setLabelDataAndTitle

      public void setLabelDataAndTitle(org.eclipse.january.dataset.IDataset labels)
      Description copied from interface: IAxis
      Sets an alternative dataset to use for the labels and the title
      Specified by:
      setLabelDataAndTitle in interface IAxis
      Parameters:
      labels -
    • getLabel

      public double getLabel(double value)
      Override to provide custom axis labels.
      Specified by:
      getLabel in interface org.eclipse.nebula.visualization.xygraph.linearscale.IScaleProvider
      Overrides:
      getLabel in class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
    • isLog10

      public boolean isLog10()
      Specified by:
      isLog10 in interface IAxis
      Returns:
    • setLog10

      public void setLog10(boolean isLog10)
      Specified by:
      setLog10 in interface IAxis
      Parameters:
      isLog10 -
    • getUpper

      public double getUpper()
      Description copied from interface: IAxis
      returns the upper bound in the units of the axis (not pixels)
      Specified by:
      getUpper in interface IAxis
    • getLower

      public double getLower()
      Description copied from interface: IAxis
      returns the lower bound in the units of the axis (not pixels)
      Specified by:
      getLower in interface IAxis
    • getValuePosition

      public int getValuePosition(double value)
      Description copied from interface: IAxis
      The position in pixels of a given value.
      Specified by:
      getValuePosition in interface IAxis
      Parameters:
      value -
      Returns:
      position
    • getPositionValue

      public double getPositionValue(int position)
      Description copied from interface: IAxis
      The value for a position in pixels.
      Specified by:
      getPositionValue in interface IAxis
      Parameters:
      position -
      Returns:
      value
    • getValueFromPosition

      public double getValueFromPosition(double position)
      Description copied from interface: IAxis
      The value for a position in pixels.
      Specified by:
      getValueFromPosition in interface IAxis
      Parameters:
      position -
      Returns:
    • getPositionFromValue

      public double getPositionFromValue(double value)
      Description copied from interface: IAxis
      The position in pixels of a given value.
      Specified by:
      getPositionFromValue in interface IAxis
      Parameters:
      value -
      Returns:
    • fireRevalidated

      protected void fireRevalidated()
      Overrides:
      fireRevalidated in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • fireAxisRangeChanged

      protected void fireAxisRangeChanged(org.eclipse.nebula.visualization.xygraph.linearscale.Range old_range, org.eclipse.nebula.visualization.xygraph.linearscale.Range new_range)
      Overrides:
      fireAxisRangeChanged in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • addAxisListener

      public void addAxisListener(IAxisListener listener)
      Description copied from interface: IAxis
      Add a listener notified when the axis changes.
      Specified by:
      addAxisListener in interface IAxis
      Parameters:
      listener -
    • removeAxisListener

      public void removeAxisListener(IAxisListener listener)
      Description copied from interface: IAxis
      Add a listener notified when the axis changes.
      Specified by:
      removeAxisListener in interface IAxis
      Parameters:
      listener -
    • setDateFormatEnabled

      public void setDateFormatEnabled(boolean dateEnabled)
      Description copied from interface: IAxis
      Sets if the date format should be formatting this axis.
      Specified by:
      setDateFormatEnabled in interface IAxis
      Parameters:
      dateEnabled -
    • isDateFormatEnabled

      public boolean isDateFormatEnabled()
      Specified by:
      isDateFormatEnabled in interface IAxis
      Returns:
      true if in date/time mode, false normally.
    • toString

      public String toString()
      Overrides:
      toString in class org.eclipse.nebula.visualization.xygraph.figures.Axis
    • isPrimaryAxis

      public boolean isPrimaryAxis()
      Specified by:
      isPrimaryAxis in interface IAxis
      Returns:
      true if axis is a primary one that cannot be deleted.
    • isLabelCustomised

      public boolean isLabelCustomised()
      Specified by:
      isLabelCustomised in interface org.eclipse.nebula.visualization.xygraph.linearscale.IScaleProvider
      Overrides:
      isLabelCustomised in class org.eclipse.nebula.visualization.xygraph.linearscale.LinearScale
    • getAutoFormat

      protected String getAutoFormat(double min, double max)
      Overrides:
      getAutoFormat in class org.eclipse.nebula.visualization.xygraph.figures.DAxis