Class Axis<ST extends AxesChartStyler, S extends AxesChartSeries>

java.lang.Object
org.knowm.xchart.internal.chartpart.Axis<ST,S>
All Implemented Interfaces:
ChartPart

public class Axis<ST extends AxesChartStyler, S extends AxesChartSeries> extends Object implements ChartPart
Axis
  • Field Details

  • Constructor Details

    • Axis

      public Axis(Chart<ST,S> chart, Axis.Direction direction, int index)
      Constructor
      Parameters:
      chart - the Chart
      direction - the axis direction (X or Y)
      index - the y-axis index (not relevant for x-axes)
  • Method Details

    • resetMinMax

      void resetMinMax()
      Reset the default min and max values in preparation for calculating the actual min and max
    • addMinMax

      void addMinMax(double min, double max)
      Parameters:
      min -
      max -
    • preparePaint

      public void preparePaint()
    • paint

      public void paint(Graphics2D g)
      Specified by:
      paint in interface ChartPart
    • getXAxisHeightHint

      private double getXAxisHeightHint(double workingSpace)
      The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to actually determine the tick labels first to get an idea of how tall the X-Axis tick labels will be.
      Returns:
      the x-axis height hint
    • getYAxisWidthHint

      private double getYAxisWidthHint(double workingSpace)
    • getAxisTickCalculator

      private AxisTickCalculator getAxisTickCalculator(double workingSpace)
    • getAxisTickCalculatorForY

      private AxisTickCalculator getAxisTickCalculatorForY(double workingSpace)
    • getAxisTickCalculatorForX

      private AxisTickCalculator_ getAxisTickCalculatorForX(double workingSpace)
    • getDataType

      Series.DataType getDataType()
    • setDataType

      public void setDataType(Series.DataType dataType)
    • getMin

      double getMin()
    • setMin

      void setMin(double min)
    • getMax

      double getMax()
    • setMax

      void setMax(double max)
    • getAxisTick

      AxisTick<ST,S> getAxisTick()
    • getDirection

      private Axis.Direction getDirection()
    • getAxisTitle

      AxisTitle<ST,S> getAxisTitle()
    • getAxisTickCalculator

      public AxisTickCalculator getAxisTickCalculator()
    • getBounds

      public Rectangle2D getBounds()
      Specified by:
      getBounds in interface ChartPart
    • getYIndex

      public int getYIndex()
    • getScreenValue

      public double getScreenValue(double chartPoint)
      Converts a chart coordinate value to screen coordinate. Same as AxisTickCalculators calculation.
      Parameters:
      chartPoint - value in chart coordinate system
      Returns:
      Coordinate of screen. eg: MouseEvent.getX(), MouseEvent.getY()
    • getScreenValueForMin

      public double getScreenValueForMin()
    • getScreenValueForMax

      public double getScreenValueForMax()
    • getChartValue

      public double getChartValue(double screenPoint)
      Converts a screen coordinate to chart coordinate value. Reverses the AxisTickCalculators calculation.
      Parameters:
      screenPoint - Coordinate of screen. eg: MouseEvent.getX(), MouseEvent.getY()
      Returns:
      value in chart coordinate system