Class TimeAxis

java.lang.Object
com.codename1.ui.chart.axis.Axis
com.codename1.ui.chart.axis.TimeAxis

public class TimeAxis extends Axis
A time axis whose values are milliseconds since the epoch. Ticks land on calendar boundaries (whole minutes, midnights, first of the month, new year) and the label format follows the tick unit, so zooming from years down to milliseconds stays readable.
  • Constructor Details

    • TimeAxis

      public TimeAxis(int position)

      Creates a time axis.

      Parameters
      • position: one of Axis.BOTTOM, Axis.LEFT, Axis.RIGHT or Axis.TOP
  • Method Details

    • flatPad

      protected double flatPad(double anchor)
      One hour each side of a single timestamp, rather than 10% of its epoch milliseconds.
      Overrides:
      flatPad in class Axis
    • adjustBounds

      protected double[] adjustBounds(double min, double max)
      Description copied from class: Axis

      Lets a subclass pad or round the automatic bounds; the default rounds a numeric range outward to the nearest nice step so the outermost grid lines sit on the plot edge.

      Parameters
      • min: the raw minimum

      • max: the raw maximum

      Returns

      {min, max} to use

      Overrides:
      adjustBounds in class Axis
    • ticks

      public double[] ticks(int maxCount)
      Description copied from class: Axis

      Ticks for the visible range.

      Parameters
      • maxCount: the most ticks the measured label size allows
      Returns

      ascending tick values

      Overrides:
      ticks in class Axis
    • defaultFormat

      protected String defaultFormat(double value, double step)
      Description copied from class: Axis
      The axis' built in formatting; numbers are grouped and localized.
      Overrides:
      defaultFormat in class Axis