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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final STthe axis tickprivate AxisTickCalculatorthe axis tick calculatorthe axis titleprivate final Rectangle2D.Doubleprivate Series.DataTypethe dataTypeprivate final Axis.Directionthe axis directionprivate final intthe axis group index *private doubleprivate doubleFields inherited from interface ChartPart
SOLID_STROKE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddMinMax(double min, double max) private AxisTickCalculatorgetAxisTickCalculator(double workingSpace) private AxisTickCalculator_getAxisTickCalculatorForX(double workingSpace) private AxisTickCalculatorgetAxisTickCalculatorForY(double workingSpace) doublegetChartValue(double screenPoint) Converts a screen coordinate to chart coordinate value.(package private) Series.DataTypeprivate Axis.Direction(package private) doublegetMax()(package private) doublegetMin()doublegetScreenValue(double chartPoint) Converts a chart coordinate value to screen coordinate.doubledoubleprivate doublegetXAxisHeightHint(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.private doublegetYAxisWidthHint(double workingSpace) intvoidpaint(Graphics2D g) void(package private) voidReset the default min and max values in preparation for calculating the actual min and maxvoidsetDataType(Series.DataType dataType) (package private) voidsetMax(double max) (package private) voidsetMin(double min)
-
Field Details
-
chart
-
bounds
-
axesChartStyler
-
axisTitle
the axis title -
axisTick
the axis tick -
direction
the axis direction -
index
private final int indexthe axis group index * -
dataType
the dataType -
axisTickCalculator
the axis tick calculator -
min
private double min -
max
private double max
-
-
Constructor Details
-
Axis
Constructor- Parameters:
chart- the Chartdirection- 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
-
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
-
getAxisTickCalculatorForY
-
getAxisTickCalculatorForX
-
getDataType
Series.DataType getDataType() -
setDataType
-
getMin
double getMin() -
setMin
void setMin(double min) -
getMax
double getMax() -
setMax
void setMax(double max) -
getAxisTick
-
getDirection
-
getAxisTitle
-
getAxisTickCalculator
-
getBounds
-
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
-