Module org.jfree.chart3d
Package org.jfree.chart3d.axis

# Class LogAxis3D

java.lang.Object
org.jfree.chart3d.axis.AbstractAxis3D
org.jfree.chart3d.axis.AbstractValueAxis3D
org.jfree.chart3d.axis.LogAxis3D

All Implemented Interfaces:
  `Serializable`, `EventListener`, `Axis3D`, `ValueAxis3D`, `ChartElement`, `MarkerChangeListener`

public class LogAxis3D extends AbstractValueAxis3D implements ValueAxis3D
A numerical axis with a logarithmic scale.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.

Since:
  1.2
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final double`
`DEFAULT_SMALLEST_VALUE`
The default value for the smallest value attribute.

### Fields inherited from class org.jfree.chart3d.axis.AbstractValueAxis3D

`range`

### Fields inherited from class org.jfree.chart3d.axis.AbstractAxis3D

`DEFAULT_LABEL_COLOR, DEFAULT_LABEL_FONT, DEFAULT_LABEL_OFFSET, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_TICK_LABEL_COLOR, DEFAULT_TICK_LABEL_FONT`

## Constructor Summary

Constructors
Constructor
Description
`LogAxis3D(String label)`
Creates a new log axis with a default base of 10.

## Method Summary

Modifier and Type
Method
Description
`protected Range`
`adjustedDataRange(Range range)`
Adjusts the range by adding the lower and upper margins on the logarithmic range.
`final double`
`calculateLog(double value)`
Calculates the log of the given `value`, using the current base.
`final double`
`calculateValue(double log)`
Calculates the value from a given log value.
`void`
`draw(Graphics2D g2, Point2D startPt, Point2D endPt, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting)`
Draws the axis.
`boolean`
`equals(Object obj)`
Tests this instance for equality with an arbitrary object.
`List<TickData>`
`generateTickData(double tickUnit)`
Generates tick data for the axis, assuming the specified tick unit (a log increment in this case).
`double`
`getBase()`
Returns the logarithmic base value.
`NumberFormat`
`getBaseFormatter()`
Returns the formatter used for the log base value when it is displayed in tick labels.
`String`
`getBaseSymbol()`
Returns the base symbol, used in tick labels for the axis.
`double`
`getSmallestValue()`
Returns the smallest positive data value that will be represented on the axis.
`Format`
`getTickLabelFormatter()`
Returns the tick label formatter.
`TickSelector`
`getTickSelector()`
Returns the tick selector for the axis.
`double`
`getTickSize()`
Returns the tick size to be used when the tick selector is `null`.
`int`
`hashCode()`
Returns a hash code for this instance.
`double`
`selectTick(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt)`
Selects a standard tick unit on the logarithmic range.
`void`
`setBase(double base)`
Sets the logarithmic base value and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setBaseFormatter(NumberFormat formatter)`
Sets the formatter for the log base value and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setBaseSymbol(String symbol)`
Sets the base symbol and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setRange(double min, double max)`
Sets the range for the axis.
`void`
`setRange(Range range)`
Sets the range for the axis.
`void`
`setSmallestValue(double smallestValue)`
Sets the smallest positive data value that will be represented on the axis and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setTickLabelFormatter(Format formatter)`
Sets the formatter for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setTickSelector(TickSelector selector)`
Sets the tick selector and sends an `Axis3DChangeEvent` to all registered listeners.
`void`
`setTickSize(double tickSize)`
Sets the tick size and sends an `Axis3DChangeEvent` to all registered listeners.
`double`
`translateToWorld(double value, double length)`
Translates a data value to a world coordinate, assuming that the axis begins at the origin and has the specified length.
`protected void`
`updateRange(Range range)`
Updates the axis range (used by the auto-range calculation) without notifying listeners.

### Methods inherited from class org.jfree.chart3d.axis.AbstractValueAxis3D

`axisStr, configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getDefaultAutoRange, getLowerMargin, getMarker, getMarkers, getMinAutoRangeLength, getRange, getTickLabelFactor, getTickLabelOffset, getTickLabelOrientation, getTickMarkLength, getTickMarkPaint, getTickMarkStroke, getUpperMargin, isAutoAdjustRange, isInverted, receive, setAutoAdjustRange, setDefaultAutoRange, setInverted, setLowerMargin, setMarker, setMinAutoRangeLength, setTickLabelFactor, setTickLabelOffset, setTickLabelOrientation, setTickMarkLength, setTickMarkPaint, setTickMarkStroke, setUpperMargin`

### Methods inherited from class org.jfree.chart3d.axis.AbstractAxis3D

`addChangeListener, drawAxisLabel, fireChangeEvent, getLabel, getLabelColor, getLabelFont, getLabelOffset, getLineColor, getLineStroke, getTickLabelColor, getTickLabelFont, getTickLabelsVisible, isVisible, markerChanged, notifyListeners, removeChangeListener, setLabel, setLabelColor, setLabelFont, setLabelOffset, setLineColor, setLineStroke, setTickLabelColor, setTickLabelFont, setTickLabelsVisible, setVisible`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.jfree.chart3d.axis.Axis3D

`addChangeListener, getLabelColor, getLabelFont, getRange, getTickLabelColor, getTickLabelFont, isInverted, isVisible, removeChangeListener, setInverted, setLabelColor, setLabelFont, setTickLabelColor, setTickLabelFont, setVisible`

### Methods inherited from interface org.jfree.chart3d.ChartElement

`receive`

### Methods inherited from interface org.jfree.chart3d.axis.ValueAxis3D

`configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getMarker`

## Field Details

### DEFAULT_SMALLEST_VALUE

public static final double DEFAULT_SMALLEST_VALUE
The default value for the smallest value attribute.

See Also:
  - Constant Field Values

## Constructor Details

### LogAxis3D

public LogAxis3D(String label)
Creates a new log axis with a default base of 10.

Parameters:
  `label` - the axis label (`null` permitted).

## Method Details

### getBase

public double getBase()
Returns the logarithmic base value. The default value is `10`.

Returns:
  The logarithmic base value.

### setBase

public void setBase(double base)
Sets the logarithmic base value and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `base` - the base value.

### getBaseSymbol

public String getBaseSymbol()
Returns the base symbol, used in tick labels for the axis. A typical value would be "e" when using a natural logarithm scale. If this is `null`, the tick labels will display the numerical base value. The default value is `null`.

Returns:
  The base symbol (possibly `null`).

### setBaseSymbol

public void setBaseSymbol(String symbol)
Sets the base symbol and sends an `Axis3DChangeEvent` to all registered listeners. If you set this to `null`, the tick labels will display a numerical representation of the base value.

Parameters:
  `symbol` - the base symbol (`null` permitted).

### getBaseFormatter

public NumberFormat getBaseFormatter()
Returns the formatter used for the log base value when it is displayed in tick labels. The default value is `NumberFormat("0")`.

Returns:
  The base formatter (never `null`).

### setBaseFormatter

public void setBaseFormatter(NumberFormat formatter)
Sets the formatter for the log base value and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `formatter` - the formatter (`null` not permitted).

### getSmallestValue

public double getSmallestValue()
Returns the smallest positive data value that will be represented on the axis. This will be used as the lower bound for the axis if the data range contains any value from `0.0` up to this value.

Returns:
  The smallest value.

### setSmallestValue

public void setSmallestValue(double smallestValue)
Sets the smallest positive data value that will be represented on the axis and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `smallestValue` - the value (must be positive).

### getTickSelector

public TickSelector getTickSelector()
Returns the tick selector for the axis.

Returns:
  The tick selector (possibly `null`).

### setTickSelector

public void setTickSelector(TickSelector selector)
Sets the tick selector and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `selector` - the selector (`null` permitted).

### getTickSize

public double getTickSize()
Returns the tick size to be used when the tick selector is `null`.

Returns:
  The tick size.

### setTickSize

public void setTickSize(double tickSize)
Sets the tick size and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `tickSize` - the new tick size.

### getTickLabelFormatter

public Format getTickLabelFormatter()
Returns the tick label formatter. The default value is `DecimalFormat("0.0")`.

Returns:
  The tick label formatter (never `null`).

### setTickLabelFormatter

public void setTickLabelFormatter(Format formatter)
Sets the formatter for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.

Parameters:
  `formatter` - the formatter (`null` not permitted).

### setRange

public void setRange(Range range)
Sets the range for the axis. This method is overridden to check that the range does not contain negative values, and to update the log values for the range.

Specified by:
  `setRange` in interface `Axis3D`
Overrides:
  `setRange` in class `AbstractValueAxis3D`
Parameters:
  `range` - the range (`nul` not permitted).

### setRange

public void setRange(double min, double max)
Sets the range for the axis. This method is overridden to check that the range does not contain negative values, and to update the log values for the range.

Specified by:
  `setRange` in interface `Axis3D`
Overrides:
  `setRange` in class `AbstractValueAxis3D`
Parameters:
  `min` - the lower bound for the range.
  `max` - the upper bound for the range.

### updateRange

protected void updateRange(Range range)
Description copied from class: `AbstractValueAxis3D`
Updates the axis range (used by the auto-range calculation) without notifying listeners.

Overrides:
  `updateRange` in class `AbstractValueAxis3D`
Parameters:
  `range` - the new range.

### calculateLog

public final double calculateLog(double value)
Calculates the log of the given `value`, using the current base.

Parameters:
  `value` - the value (negatives not permitted).
Returns:
  The log of the given value.
See Also:
  - `calculateValue(double)`
  - `getBase()`

### calculateValue

public final double calculateValue(double log)
Calculates the value from a given log value.

Parameters:
  `log` - the log value.
Returns:
  The value with the given log.
See Also:
  - `calculateLog(double)`
  - `getBase()`

### translateToWorld

public double translateToWorld(double value, double length)
Translates a data value to a world coordinate, assuming that the axis begins at the origin and has the specified length.

Specified by:
  `translateToWorld` in interface `Axis3D`
Parameters:
  `value` - the data value.
  `length` - the axis length in world coordinates.
Returns:
  The world coordinate of this data value on the axis.

### draw

public void draw(Graphics2D g2, Point2D startPt, Point2D endPt, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting)
Draws the axis.

Specified by:
  `draw` in interface `Axis3D`
Specified by:
  `draw` in class `AbstractAxis3D`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `startPt` - the starting point.
  `endPt` - the ending point.
  `opposingPt` - an opposing point (labels will be on the other side of the line).
  `tickData` - the tick data (including anchor points calculated by the 3D engine).
  `info` - an object to be populated with rendering info (`null` permitted).
  `hinting` - perform element hinting?

### adjustedDataRange

protected Range adjustedDataRange(Range range)
Adjusts the range by adding the lower and upper margins on the logarithmic range.

Specified by:
  `adjustedDataRange` in class `AbstractValueAxis3D`
Parameters:
  `range` - the range (`nul` not permitted).
Returns:
  The adjusted range.

### selectTick

public double selectTick(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt)
Selects a standard tick unit on the logarithmic range.

Specified by:
  `selectTick` in interface `ValueAxis3D`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `pt0` - the starting point.
  `pt1` - the ending point.
  `opposingPt` - an opposing point.
Returns:
  The tick unit (log increment).

### generateTickData

public List<TickData> generateTickData(double tickUnit)
Generates tick data for the axis, assuming the specified tick unit (a log increment in this case). If the tick unit is Double.NaN then ticks will be added for the bounds of the axis only.

Specified by:
  `generateTickData` in interface `ValueAxis3D`
Parameters:
  `tickUnit` - the tick unit.
Returns:
  A list of tick data items.

### hashCode

public int hashCode()
Description copied from class: `AbstractAxis3D`
Returns a hash code for this instance.

Overrides:
  `hashCode` in class `AbstractAxis3D`
Returns:
  A hash code.

### equals

public boolean equals(Object obj)
Description copied from class: `AbstractAxis3D`
Tests this instance for equality with an arbitrary object.

Overrides:
  `equals` in class `AbstractValueAxis3D`
Parameters:
  `obj` - the object to test against (`null` permitted).
Returns:
  A boolean.