Class Axis

java.lang.Object
org.aesh.charts.axis.Axis

public class Axis extends Object
Renders a numeric axis with labels and tick marks.
  • Constructor Details

    • Axis

      public Axis()
  • Method Details

    • min

      public Axis min(double min)
    • max

      public Axis max(double max)
    • label

      public Axis label(String label)
    • scale

      public Axis scale(Scale scale)
    • tickCount

      public Axis tickCount(int tickCount)
    • format

      public Axis format(String pattern)
    • min

      public double min()
    • max

      public double max()
    • label

      public String label()
    • scale

      public Scale scale()
    • autoRange

      public void autoRange(double dataMin, double dataMax)
      Auto-set min/max from data range with padding.
    • normalize

      public double normalize(double value)
      Map a data value to a normalized position (0.0 = min, 1.0 = max).
    • denormalize

      public double denormalize(double normalized)
      Map a normalized position (0.0-1.0) back to a data value.
    • tickValues

      public double[] tickValues()
      Generate tick values for this axis.
    • formatTick

      public String formatTick(double value)
      Format a tick value as a label string.
    • labelWidth

      public int labelWidth()
      Compute the width needed for Y-axis labels (max label width + 1 for tick mark).
    • drawYAxis

      public void drawYAxis(Canvas canvas, int x, int yTop, int yBottom, ChartStyle style)
      Draw a left Y-axis on the canvas.
      Parameters:
      canvas - the canvas
      x - x position of the axis line
      yTop - top y position
      yBottom - bottom y position
      style - chart style
    • drawXAxis

      public void drawXAxis(Canvas canvas, int xLeft, int xRight, int y, ChartStyle style)
      Draw a bottom X-axis on the canvas.
      Parameters:
      canvas - the canvas
      xLeft - left x position
      xRight - right x position
      y - y position of the axis line
      style - chart style