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

## com.java4less.rchart
Class Axis

    java.lang.Object
      |
      +--com.java4less.rchart.ChartComponent
            |
            +--com.java4less.rchart.Axis

public class Axis
extends ChartComponent

    Axis is made of:

    - The line
    - The ticks (small and big)
    - The labels (text displayed next to the big ticks)
    - Grid
    - Scale

    Example:

    // create 2 axis with scale and orientation
    com.java4less.rchart.Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());
    com.java4less.rchart.Axis YAxis=new Axis(Axis.VERTICAL,new Scale());
    // set scale values
    XAxis.scale.min=0;
    YAxis.scale.min=0;
    // set the tick configuration
    Axis.scaleTickInterval=1;
    XAxis.scaleTickInterval=1;
    // add user defined labels
    String[] lbls={"June","July","Aug.","Sept.","Oct.","Nov.","Dec."};
    XAxis.tickLabels=lbls;

Field Summary
`int` | `autoNumberOfTicks` Defautl is 0.
`boolean` | `axisFrame` if true, axis lines will be painted on all four sides of the chart.
`static int` | `BAR_STYLE_BAR`
`static int` | `BAR_STYLE_NONE`
`static int` | `BAR_STYLE_RAISED_BAR`
`FillStyle` | `barFilling` filling of the axis if its barstyle is not NONE
`int` | `barStyle` style of the axis regular or bars
`int` | `barWidth` width of the axis bar if style is not regular
`int` | `bigTickInterval` A value of 5 means that a big tick will be displayed after 4 small ticks.
`int[]` | `bigTickIntervalList` list of positions where big ticks should be painted. axis.bigTickIntervalList={1,3,6}; means: paint a big tick after 1, 3 and 6 small ticks
`int` | `bigTickPixels` length of the line used to draw big ticks.
`boolean` | `bigTicksGrid` if true the grid will be displayed only for the big ticks.
`int` | `ceroAxis` displays a cero axis if there are negative values in the chart.
`static int` | `CEROAXIS_LINE` line at value 0 of the scale
`static int` | `CEROAXIS_NO` no line at value 0 of the scale
`static int` | `CEROAXIS_SCALE`
`LineStyle` | `ceroAxisStyle` style of the cero axis.
`java.lang.String` | `dateLabelFormat` date format for date labels (only if initialDate!=null).
`java.lang.String` | `dateStep` date step for ticks (only if initialDate!=null) .
`boolean` | `dateStepPerUnit` if true, the value of dateStep will define the step for each unit of the axis
`ChartColor` | `DescColor` Color of the text used to display the labels.
`ChartFont` | `DescFont` Font of the text used to display the labels.
`FillStyle` | `gridFillStyle` Style of the grid (filling).
`LineStyle` | `gridStyle` Style of the grid (line).
`static int` | `HORIZONTAL` X Axis
`java.util.Date` | `initialDate` this date will be used as based if you want to calculate dates for the tick labels.
`boolean` | `IntegerScale` if true, the labels will be shown as integer values.
`java.lang.String` | `label` description label of the axis
`java.lang.String` | `labelTemplate` template for the ChartLabel object using the @ tags.
`boolean` | `logarithmicIntervals` only if you use logarithmic scales.
`int` | `orientation` orientation of the axis.
`Axis` | `peerAxis` internal use.
`Plotter` | `plot` internal use.
`int` | `rotateLabels` rotation angle of the labels
`Scale` | `scale` scale assigned to the axis.
`java.lang.String` | `scaleLabelFormat` this format will be used to draw the label.
`double` | `scaleTickInterval` A value of 100 means that the ticks will be displayed in intervals of 100.
`boolean` | `stackAdditionalAxis` place the axis next to each other or stack them to create several charts on the top/next to the other?
`boolean` | `startWithBigTick` if "true" the first tick in the axis will be a big ticks (with label).
`LineStyle` | `style` Style of the axis.
`boolean` | `tickAtBase` if true draws the first tick at scale.min.
`int` | `tickLabelLength` maximum number of characters per label.
`java.lang.String[]` | `tickLabels` Labels display at big ticks.
`int` | `tickPixels` length of the line used to draw ticks.
`double[]` | `ticks_preferred_Interval` Only used if autoNumberOfTicks<>=0.
`static int` | `VERTICAL` Y axis
`boolean` | `xscaleOnTop` X Axis should be painted o the top of the chart instead of the bottom which is the default

Fields inherited from class com.java4less.rchart.ChartComponent
`height, width, x, y`

Constructor Summary
`Axis(int o, Scale s)` creates an axis with an orientation and scale.

Method Summary
`void` | `addAdditionalAxis(Axis axis)` add an additional axis to this axis
`void` | `addTargetZone(AxisTargetZone zone)` add new targe zone
`static double` | `convertFromDate(java.util.Date d, java.lang.String dateStep, java.util.Date initialDate)` convert a date to a numeric value for date based axis/scales.
`void` | `draw(ChartGraphics g, Axis peerAxis, boolean drawForeGround, boolean drawGridBackground)` draws the axis.
`AxisTargetZone[]` | `getTargetZones()` get list of all target zones
`void` | `removeTargetZones()` delete all target zones

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

Field Detail

### HORIZONTAL

    public static final int HORIZONTAL

  X Axis

  See Also:
    Constant Field Values

### VERTICAL

    public static final int VERTICAL

  Y axis

  See Also:
    Constant Field Values

### CEROAXIS_LINE

    public static final int CEROAXIS_LINE

  line at value 0 of the scale

  See Also:
    Constant Field Values

### CEROAXIS_NO

    public static final int CEROAXIS_NO

  no line at value 0 of the scale

  See Also:
    Constant Field Values

### CEROAXIS_SCALE

    public static final int CEROAXIS_SCALE

See Also:
  Constant Field Values

### BAR_STYLE_NONE

    public static final int BAR_STYLE_NONE

See Also:
  Constant Field Values

### BAR_STYLE_BAR

    public static final int BAR_STYLE_BAR

See Also:
  Constant Field Values

### BAR_STYLE_RAISED_BAR

    public static final int BAR_STYLE_RAISED_BAR

See Also:
  Constant Field Values

### label

    public java.lang.String label

  description label of the axis

### barStyle

    public int barStyle

  style of the axis regular or bars

### barWidth

    public int barWidth

  width of the axis bar if style is not regular

### barFilling

    public FillStyle barFilling

  filling of the axis if its barstyle is not NONE

### xscaleOnTop

    public boolean xscaleOnTop

  X Axis should be painted o the top of the chart instead of the bottom which is the default

### axisFrame

    public boolean axisFrame

  if true, axis lines will be painted on all four sides of the chart. The result will be a frame around the chart.

### dateLabelFormat

    public java.lang.String dateLabelFormat

  date format for date labels (only if initialDate!=null). Default is dd-MMM-yyyy

### dateStep

    public java.lang.String dateStep

  date step for ticks (only if initialDate!=null) . The default is "d" which means 1 step is 1 day. Other values are "m" (months), "w" (week) , "y" (year) and "d3" ( 3 days).

### dateStepPerUnit

    public boolean dateStepPerUnit

  if true, the value of dateStep will define the step for each unit of the axis

### initialDate

    public java.util.Date initialDate

  this date will be used as based if you want to calculate dates for the tick labels. Incompatible with logarithmic scales.

### IntegerScale

    public boolean IntegerScale

  if true, the labels will be shown as integer values. Default is false

### autoNumberOfTicks

    public int autoNumberOfTicks

  Defautl is 0. If <> 0 Chart will calculate the tick interval to get the desired amount of ticks

### ticks_preferred_Interval

    public double[] ticks_preferred_Interval

  Only used if autoNumberOfTicks<>=0. RChart will use the tick_interval in this list which is more appropiate to get the desired amount of ticks.
  Default is:
  new {0.1,0.5,1,5,10,25,50,100,250,500,1000,5000,10000,50000,100000,500000,1000000};
  For example, if your values range from 0 till 300 and the desired number of ticks is 10. RChart will select tick_interval=25 which will result in 12 ticks.

### scaleLabelFormat

    public java.lang.String scaleLabelFormat

  this format will be used to draw the label. For example "#####.00" will always display 2 decimal digits. The format uses the following symbols:
  0 a digit,
  # a digit, zero shows as absent
  . placeholder for decimal separator
  , placeholder for grouping separator.
  - default negative prefix.

### labelTemplate

    public java.lang.String labelTemplate

  template for the ChartLabel object using the @ tags. The place holder #value# will be replaced with the value for the tick.

### logarithmicIntervals

    public boolean logarithmicIntervals

  only if you use logarithmic scales. If "true" the ticks will be printed at logarithmic intervals (which is fixed intervals in the screen). If false the TICK_INTERVAL will be used to draw the ticks at fixed value intervals (not screen intervals).

### scale

    public Scale scale

  scale assigned to the axis.

### bigTicksGrid

    public boolean bigTicksGrid

  if true the grid will be displayed only for the big ticks. If false (default) will be displayed for all ticks.

### scaleTickInterval

    public double scaleTickInterval

  A value of 100 means that the ticks will be displayed in intervals of 100. That's, first tick at scale.min , second at scale.min+100 third at scale.min+200...

### bigTickInterval

    public int bigTickInterval

  A value of 5 means that a big tick will be displayed after 4 small ticks.

### bigTickIntervalList

    public int[] bigTickIntervalList

  list of positions where big ticks should be painted.
  axis.bigTickIntervalList={1,3,6};
  means: paint a big tick after 1, 3 and 6 small ticks

### tickPixels

    public int tickPixels

  length of the line used to draw ticks.

### bigTickPixels

    public int bigTickPixels

  length of the line used to draw big ticks.

### plot

    public Plotter plot

  internal use.

### peerAxis

    public Axis peerAxis

  internal use.

### ceroAxis

    public int ceroAxis

  displays a cero axis if there are negative values in the chart. Valid values are CEROAXIS_NO, CEROAXIS_LINE and CEROAXIS_SCALE.

### ceroAxisStyle

    public LineStyle ceroAxisStyle

  style of the cero axis.

### tickAtBase

    public boolean tickAtBase

  if true draws the first tick at scale.min. If false at scale.min+ scaleTickInterval.

### rotateLabels

    public int rotateLabels

  rotation angle of the labels

### style

    public LineStyle style

  Style of the axis.

### gridStyle

    public LineStyle gridStyle

  Style of the grid (line). If null (default) no grid is displayed.

### gridFillStyle

    public FillStyle gridFillStyle

  Style of the grid (filling). If null (default) no grid is displayed.

### orientation

    public int orientation

  orientation of the axis. Valid values are VERTICAL or HORIZONTAL.

### DescColor

    public ChartColor DescColor

  Color of the text used to display the labels.

### DescFont

    public ChartFont DescFont

  Font of the text used to display the labels.

### tickLabels

    public java.lang.String[] tickLabels

  Labels display at big ticks. If null the scale value will be used.

### startWithBigTick

    public boolean startWithBigTick

  if "true" the first tick in the axis will be a big ticks (with label).

### tickLabelLength

    public int tickLabelLength

  maximum number of characters per label. Create a new line if exceeded

### stackAdditionalAxis

    public boolean stackAdditionalAxis

  place the axis next to each other or stack them to create several charts on the top/next to the other?

Constructor Detail

### Axis

    public Axis(int o,
                Scale s)

  creates an axis with an orientation and scale.

Method Detail

### addAdditionalAxis

    public void addAdditionalAxis(Axis axis)

  add an additional axis to this axis

  Parameters:
    `axis` -

### convertFromDate

    public static double convertFromDate(java.util.Date d,
                                         java.lang.String dateStep,
                                         java.util.Date initialDate)

  convert a date to a numeric value for date based axis/scales. Use this to construct your data series for date/time based axis.

  Parameters:
    `d` - date to be converted
    `dateStep` - date unit of the scale (d-day, m-month, y-year, w-week, h-hour, s-second, n-minutes)
    `initialDate` - base (minimum) date of the axis/scale
  Returns:

### addTargetZone

    public void addTargetZone(AxisTargetZone zone)

  add new targe zone

  Parameters:
    `zone` -

### removeTargetZones

    public void removeTargetZones()

  delete all target zones

### getTargetZones

    public AxisTargetZone[] getTargetZones()

  get list of all target zones

  Returns:

### draw

    public void draw(ChartGraphics g,
                     Axis peerAxis,
                     boolean drawForeGround,
                     boolean drawGridBackground)

  draws the axis. This is called by RChart.

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