Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.charts
Class Axis

    java.lang.Object
      umontreal.iro.lecuyer.charts.Axis

    public class Axis

extends Object

Represents an axis of a chart encapsulated by an instance of `XYChart`. `Axis` uses the JFreeChart class `NumberAxis` to store some axis properties. This class represents the x-axis or the y-axis of a `XYChart` and, consequently, is drawn when calling the `toLatex` method. It provides tools to customize the axis in modifying labels and description.

Field Summary
`static boolean` | `ORIENTATION_HORIZONTAL`
`static boolean` | `ORIENTATION_VERTICAL`

Constructor Summary
`Axis(org.jfree.chart.axis.NumberAxis inAxis, boolean orientation)` Create a new `Axis` instance from an existing `NumberAxis` instance with vertical (y-axis) or horizontal (x-axis) orientation.

Method Summary
`void` | `disableCustomLabels()` Disables the use of custom labels for the current axis.
`void` | `enableCustomLabels()` Enables the use of custom labels for the current axis.
`String` | `getLabel()` Returns the axis description.
`double` | `getTwinAxisPosition()` Returns the drawing position parameter (default equals 0).
`void` | `setLabel(String label)` Sets the axis description.
`void` | `setLabels(double tick)` Sets a periodic label display.
`void` | `setLabels(double[] position)` Sets the position of each label on this axis.
`void` | `setLabels(double[] position, String[] label)` Assigns custom labels to user-defined positions on the axis.
`void` | `setLabelsAuto()` Calculates and sets an automatic tick unit.
`void` | `setTwinAxisPosition(double position)` Defines where the opposite axis must be drawn on the current axis, where it should appear, and on which label.
`String` | `toLatex(double scale)` Formats and returns a string containing a LATEX-compatible source code which represents this axis and its parameters.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ORIENTATION_VERTICAL

    public static final boolean ORIENTATION_VERTICAL

See Also:
  Constant Field Values

### ORIENTATION_HORIZONTAL

    public static final boolean ORIENTATION_HORIZONTAL

See Also:
  Constant Field Values

Constructor Detail

### Axis

    public Axis(org.jfree.chart.axis.NumberAxis inAxis,
                boolean orientation)

  Create a new `Axis` instance from an existing `NumberAxis` instance with vertical (y-axis) or horizontal (x-axis) orientation.

  Parameters:
    `inAxis` - NumberAxis instance associated to the new variable.
    `orientation` - axis direction, horizontal or vertical

Method Detail

### getLabel

    public String getLabel()

  Returns the axis description.

  Returns:
    the axis description.

### setLabel

    public void setLabel(String label)

  Sets the axis description. This description will be displayed on the chart, near the axis.

  Parameters:
    `label` - axis label.

### setLabels

    public void setLabels(double tick)

  Sets a periodic label display. Labels will be shown every `tick` unit. This tick unit replaces the default unit even though manual labeling is disabled.

  Parameters:
    `tick` - tick unit.

### setLabelsAuto

    public void setLabelsAuto()

  Calculates and sets an automatic tick unit.

### setLabels

    public void setLabels(double[] position)

  Sets the position of each label on this axis. This method requires an array containing an increasing sequence of numbers representing the positions at which labels will appear on the axis. This method is designed to export the axis to a PGF/TikZ source code; it has no effect on the chart appearance displayed with `XYChart.view()`.

  Parameters:
    `position` - new label positions.

### setLabels

    public void setLabels(double[] position,
                          String[] label)

  Assigns custom labels to user-defined positions on the axis. This method requires an array of positions as well as an array of labels. The label `label[i]` will be used at position `position[i]`. This method is designed to export the axis to a PGF/TikZ source code, and to use LATEX/TikZ commands to write prettier characters; it has no effect on the chart appearance displayed with `XYChart.view()`.

  Parameters:
    `position` - label series position on the axis.
    `label` - label series name on the axis.

### enableCustomLabels

    public void enableCustomLabels()

  Enables the use of custom labels for the current axis. The method `setLabels` must be used to set the custom labels.

### disableCustomLabels

    public void disableCustomLabels()

  Disables the use of custom labels for the current axis.

### getTwinAxisPosition

    public double getTwinAxisPosition()

  Returns the drawing position parameter (default equals 0).

  Returns:
    drawing position parameter.

### setTwinAxisPosition

    public void setTwinAxisPosition(double position)

  Defines where the opposite axis must be drawn on the current axis, where it should appear, and on which label.

  Parameters:
    `position` - new drawing position.

### toLatex

    public String toLatex(double scale)

  Formats and returns a string containing a LATEX-compatible source code which represents this axis and its parameters.

  Parameters:
    `scale` - current axis wished scale.
  Returns:
    LaTeX source code in a String.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.