public class

NumberAxis

extends Axis<T extends Comparable<T>, U>
java.lang.Object
   ↳ com.shinobicontrols.charts.Axis<T extends java.lang.Comparable<T>, U>
     ↳ com.shinobicontrols.charts.NumberAxis
Known Direct Subclasses

Class Overview

Subclass of Axis that is designed to work with numerical data points.

The value units for tick marks are of type Double. The frequency units for tick marks are of type Double.

NumberAxis is appropriate for any numeric data which is representable using java.lang.Number or its subclasses, and will accept Data objects parametrized to those types.

Summary

Public Constructors
NumberAxis()
Constructs a NumberAxis.
NumberAxis(NumberRange defaultRange)
Constructs a NumberAxis with the specified range set as its default range.
Public Methods
String getFormattedString(Double value)
Gets a string representing the current value.
DecimalFormat getLabelFormat()
Gets the label format you have supplied.
final double getZoomLevel()
Returns the current zoom level, relative to this axis' default range.
void setLabelFormat(DecimalFormat labelFormat)
Sets the label format.
Protected Methods
Double transformChartValueToUserValue(Double chartValue)
Transforms an internal data value into an externally visible value.
Double transformUserValueToChartValue(Double userValue)
Transforms an externally visible data value into an internal value.
[Expand]
Inherited Methods
From class com.shinobicontrols.charts.Axis
From class java.lang.Object

Public Constructors

public NumberAxis ()

Constructs a NumberAxis.

public NumberAxis (NumberRange defaultRange)

Constructs a NumberAxis with the specified range set as its default range. See setDefaultRange(Range) for the implications of setting this type of range.

Parameters
defaultRange The range to set as the default range for this axis

Public Methods

public String getFormattedString (Double value)

Gets a string representing the current value. This is a convenience method which you may use to format values as the axis does. It is called from within the chart, but it is generally unnecessary to override it, as the format objects (either internal or user-supplied) are intended for this kind of customization.

Parameters
value The value to set
Returns
  • The formatted tick mark label string

public DecimalFormat getLabelFormat ()

Gets the label format you have supplied. Note that if you do not supply a format object, the axis will use its internal one

Returns
  • The label format

public final double getZoomLevel ()

Returns the current zoom level, relative to this axis' default range.

Returns
  • the current zoom level for this axis

public void setLabelFormat (DecimalFormat labelFormat)

Sets the label format. This will override the default behavior of using an internal format and instead, the provided DecimalFormat object will be used. Passing in a null to this method will reset the behavior back to default, where the internal format will be used. If you subclass DecimalFormat to supply your own implementation you will probably want to override the (double, java.lang.StringBuffer, java.text.FieldPosition) method.

Parameters
labelFormat The format to set
See Also

Protected Methods

protected Double transformChartValueToUserValue (Double chartValue)

Transforms an internal data value into an externally visible value.

This allows you to add a mapping between your data and the chart, and you do not need to override this unless you have an advanced customization scenario. The default behavior does nothing.

Parameters
chartValue The chart's data value
Returns
  • Your data value

protected Double transformUserValueToChartValue (Double userValue)

Transforms an externally visible data value into an internal value.

This allows you to add a mapping between your data and the chart, and you do not need to override this unless you have an advanced customization scenario. The default behavior does nothing.

Parameters
userValue Your data value
Returns
  • The chart's data value