JMSL Chart Programmer's Guide
2D Drawing Elements >> AxisXY >> Axis Label  Previous Page  Contents  Next Page

Axis Label

The AxisLabel node controls the labeling of an axis. The drawing of this node is controlled by the Text Attributes.

Scientific Notation

If the values along an axis are large, scientific notation is more readable than a decimal format with many zeros. In this example the y-axis is labeled with scientific notation where each number has exactly two fractional digits displayed. This format pattern is "0.00E0". See java.text.DecimalFormat for details on number formatting patterns.

Date Labels

If the TextFormat attribute for an axis is an instance of DateFormat, then the axis is scaled and labeled as a date/time axis, instead of as a real axis.

Date information passed to the Date constructor must be a double number representing the number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. This is used by the constructor for Date.

Skipping Weekends

An additional feature of Date axes is the ability to skip weekends. This feature is often needed for charting stock price data.

To skip weekends it is necessary to adjust the autoscaling for weekdays-only. This is done by setting the attribute SkipWeekends to true. It is also necessary to set a custom transformation, TransformDate, on the axis. This is shown in the following example, which is a modification of the example in the previous section.

Skipping weekends is intended only for data sets where no weekend data exists. It will not give the expected results if the data set contains weekend data.

String Labels

Any array of strings can be used to label the tick marks using the setLabels(String[]) method. The setLabels(String[]) method sets the Number attribute to the number of strings.



©  Visual Numerics, Inc.  All rights reserved.  Previous Page  Contents  Next Page