Class Axis2D

java.lang.Object
com.iizix.prop.GProp<GProp<?>[]>
com.iizix.prop.PropCnr
com.iizix.prop.ui.chart.axis2d.Axis2D
All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, IPropCnrBooleanSettings<AxisOption>, IPropCnrChoiceSettings<IAxisChoiceOption>, IPropCnrColorSettings<AxisColor>, IPropCnrFontSettings<AxisFont>, IPropCnrIntegerSettings<AxisInteger>, IPropCnrKStringSettings<AxisKString>, IPropCnrNumberSettings<AxisNumber>, IPropCnrStrokeSettings<AxisStroke>, IChartContainer, Cloneable
Direct Known Subclasses:
EAxis2D

A chart axis is normally added to charts. They are either created in the Designer or constructed at runtime and added to the chart. The Designer chart axis persists in XML and can be predefined and only modified at runtime with the required settings.

The axis has several options for defining axes. The first option is vertical, which determines if the axis is vertical or horizontal, and defaults to false, which of course means the axis would be horizontal. Make sure that your alignment matches with values set for hAxis and vAxis, which should be "x" and "y", by default, on your plot or your chart will not render and the validation will produce an error.

Next there are the fixUpper and fixLower settings, which align the ticks and have 4 available options: MAJOR, MINOR, MICRO, and NONE. These default to NONE, and when set will force the end bounds to align to the corresponding tick division. If NONE is chosen, the end bounds will be the highest and lowest values in the data set.

Another related option is the "includeZero" option, which will make the lower bound be zero instead of the lowest value. If the lowest data value is negative the "includeZero" option has no effect.

If you wish to have two axis in the same direction, the second one should be set to be secondary. A secondary axis for horizontal is placed above the chart, and for a vertical axis on the right side (unless Right-To-Left [RTL] is in effect).

You can use this to have different min/max ranges for the different axis in the same direction for different data series that are using the axes in question. You will then change the perspective of the second data set to the secondary axis and you have full control to adjust the axis in almost every way possible.

You can turn on and off the tick marks at the minor and micro level, and turn labels on and off for the major and minor levels. There's natural (floating point numbers), which forces all ticks to be on natural numbers, and fixed which will fix the precision on your labels. If you want you can define the step between the ticks.

You can control the color of the axis, the color and length of your tick marks, and the font and color of your labels.

Styled Axis

You can also add a grid at your tick marks to your entire chart by adding a Grid plot. The grid plot allows you to turn the grid on and off for major and minor ticks in both directions, and you can assign axes names if you have multiple axes.

Last but not least, you have the ability to assign custom labels to your axis. Make sure to allow sufficient space in your chart area in the panel for the text to display properly.

Author:
Christopher Mindus
  • Constructor Details

    • Axis2D

      public Axis2D(String name)
      Constructs a new horizontal axis from a name.
      Parameters:
      name - The name of the series. The name MUST be a valid Atom name and cannot start with "$".
      Throws:
      NullPointerException - If the name is null.
      IllegalArgumentException - If the name is invalid.
    • Axis2D

      public Axis2D(String name, boolean isVertical)
      Constructs a new horizontal axis from a name.
      Parameters:
      name - The name of the series. The name MUST be a valid Atom name.
      isVertical - The vertical flag.
      Throws:
      NullPointerException - If the name is null.
      IllegalArgumentException - If the name is invalid.
    • Axis2D

      public Axis2D()
      Constructs a new axis without a name.

      This constructor is used by the persistence framework and should not be used.

    • Axis2D

      public Axis2D(Atom atom)
      Constructs a new axis from an Atom name.

      This constructor is used by the persistence framework and should not be used.

      Parameters:
      atom - The atom name.
  • Method Details

    • getContainerType

      public final IChartContainer.Type getContainerType()
      Gets the type of container.
      Specified by:
      getContainerType in interface IChartContainer
      Returns:
      Type.AXIS.
    • clone

      public Axis2D clone()
      Clone must be overridden.
      Overrides:
      clone in class PropCnr
    • getFixLower

      public AxisFixLower getFixLower()
      Gets the fixLower option.
      Returns:
      The choice set, or the AxisFixLower.NONE if the option is undefined.
    • getFixUpper

      public AxisFixUpper getFixUpper()
      Gets the fixUpper option.
      Returns:
      The choice set, or the AxisFixUpper.NONE if the option is undefined.
    • getPosition

      public AxisPosition getPosition()
      Gets the position of the axis.
      Returns:
      The choice set, or the AxisPosition.LEFT_OR_BOTTOM if the option is undefined.
    • getTitleOrientation

      public AxisTitleOrientation getTitleOrientation()
      Gets the title orientation.
      Returns:
      The choice set, or the AxisTitleOrientation.AXIS if the option is undefined.
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property container. The check performed is the extension of classes and that no circular reference is present.
      Specified by:
      verify in interface IGProp<GProp<?>[]>
      Overrides:
      verify in class PropCnr
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.