Class Axis<ST extends AxesChartStyler,​S extends AxesChartSeries>

    • Constructor Detail

      • 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 Detail

      • 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​(java.awt.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)
      • getMin

        double getMin()
      • setMin

        void setMin​(double min)
      • getMax

        double getMax()
      • setMax

        void setMax​(double max)
      • getBounds

        public java.awt.geom.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