SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Axis Class Reference

Represents an axis of a chart encapsulated by an instance of XYChart. More...

Public Member Functions

 Axis (NumberAxis inAxis, boolean orientation)
 Create a new Axis instance from an existing NumberAxis instance with vertical ( \(y\)-axis) or horizontal ( \(x\)-axis) orientation. More...
 
String getLabel ()
 Returns the axis description. More...
 
void setLabel (String label)
 Sets the axis description. More...
 
void setLabels (double tick)
 Sets a periodic label display. More...
 
void setLabelsAuto ()
 Calculates and sets an automatic tick unit.
 

Static Public Attributes

static final boolean ORIENTATION_VERTICAL = false
 
static final boolean ORIENTATION_HORIZONTAL = true
 

Protected Member Functions

NumberAxis getAxis ()
 Returns the NumberAxis instance (from JFreeChart) linked with the current variable. More...
 

LaTex-specific methods

void enableCustomLabels ()
 Not used anymore.
 
void disableCustomLabels ()
 Not used anymore.
 
void setLabels (double[] position)
 Sets the position of each label on this axis. More...
 
void setLabels (double[] position, String[] label)
 Assigns custom labels to user-defined positions on the axis. More...
 
double getTwinAxisPosition ()
 Returns the drawing position parameter (default equals 0). More...
 
void setTwinAxisPosition (double position)
 Defines where the opposite axis must be drawn on the current axis, where it should appear, and on which label. More...
 
String toLatex (double scale)
 Formats and returns a string containing a LaTeX-compatible source code which represents this axis and its parameters. More...
 
void setTick0Flag (boolean flag)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Axis()

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
inAxisNumberAxis instance associated to the new variable.
orientationaxis direction, horizontal or vertical

Member Function Documentation

◆ getAxis()

NumberAxis getAxis ( )
protected

Returns the NumberAxis instance (from JFreeChart) linked with the current variable.

Returns
the NumberAxis instance (from JFreeChart) linked with the current variable.

◆ getLabel()

String getLabel ( )

Returns the axis description.

Returns
the axis description.

◆ getTwinAxisPosition()

double getTwinAxisPosition ( )

Returns the drawing position parameter (default equals 0).

Returns
drawing position parameter.

◆ setLabel()

void setLabel ( String  label)

Sets the axis description.

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

Parameters
labelaxis label.

◆ setLabels() [1/3]

void setLabels ( double  tick)

Sets a periodic label display.

Labels will be shown every tick unit. This tick unit replaces the default unit.

Parameters
ticktick unit.

◆ setLabels() [2/3]

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. It is designed to export the axis to a LaTeX source code; it has no effect on the chart appearance displayed with XYChart.view().

Parameters
positionnew label positions.

◆ setLabels() [3/3]

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]. It is designed to export the axis to a LaTeX 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
positionlabel series position on the axis.
labellabel series name on the axis.

◆ setTwinAxisPosition()

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
positionnew drawing position.

◆ toLatex()

String toLatex ( double  scale)

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

Returns
LaTeX source code in a String.
Parameters
scalecurrent axis wished scale.

The documentation for this class was generated from the following file: