Q
- The pixel type of the image you'll be drawing the axes toI
- The type of image being drawn topublic class AxesRenderer2D<Q,I extends Image<Q,I>> extends Object implements DataUnitsTransformer<Q,double[],int[]>
Constructor and Description |
---|
AxesRenderer2D()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
int[] |
calculatePosition(double[] units)
For a given coordinate in the units of the data, will calculate
the render coordinates
|
Point2d |
calculatePosition(double x,
double y)
Helper function to calulate the render position of a data unit
|
double[] |
calculateUnitsAt(int[] position)
Calculates the data unit coordinate at the given render coordinates
|
int |
getAxisPaddingBottom() |
int |
getAxisPaddingLeft() |
int |
getAxisPaddingRight() |
int |
getAxisPaddingTop() |
double |
getMaxYValue()
Returns the maximum value of the y axis
|
DataUnitsTransformer<Q,double[],int[]> |
getRelativePixelTransformer(int xOffset,
int yOffset)
Returns a data pixel transformer that is based on this axes renderer but has its values
offset by the given number of pixels.
|
AxisConfig<Q> |
getxAxisConfig() |
double |
getxAxisPosition()
The y position of the x axis.
|
AxisRenderer2D<Q> |
getxAxisRenderer() |
AxisConfig<Q> |
getyAxisConfig() |
AxisRenderer2D<Q> |
getyAxisRenderer() |
boolean |
isAutoScaleAxes() |
static void |
main(String[] args) |
void |
precalc()
Config may be null as it is not used.
|
void |
renderAxis(I image)
Render the axis to the given image
|
int[] |
scaleDimension(double[] dimension)
Given a specific data dimension, calculates a render dimension.
|
double[] |
scaleDimensions(double xs,
double ys)
Given two dimensions, returns the dimensions scaled to the appropriate sizes.
|
void |
setAutoScaleAxes(boolean autoScaleAxes) |
void |
setAutoSpaceLabels(boolean autoSpaceLabels) |
void |
setAutoSpaceTicks(boolean autoSpaceTicks) |
void |
setAxisPaddingBottom(int axisPaddingBottom) |
void |
setAxisPaddingLeft(int axisPaddingLeft) |
void |
setAxisPaddingRight(int axisPaddingRight) |
void |
setAxisPaddingTop(int axisPaddingTop) |
void |
setDrawMajorTickGrid(boolean drawMajorTickGrid) |
void |
setDrawMinorTickGrid(boolean drawMinorTickGrid) |
void |
setDrawXAxis(boolean drawXAxis) |
void |
setDrawXAxisName(boolean drawXAxisName) |
void |
setDrawXTickLabels(boolean drawXTickLabels) |
void |
setDrawXTicks(boolean drawXTicks) |
void |
setDrawYAxis(boolean drawYAxis) |
void |
setDrawYAxisName(boolean drawYAxisName) |
void |
setDrawYTickLabels(boolean drawYTickLabels) |
void |
setDrawYTicks(boolean drawYTicks) |
void |
setImage(I image) |
void |
setMajorGridColour(Q majorGridColour) |
void |
setMajorGridThickness(int majorGridThickness) |
void |
setMajorTickColour(Q majorTickColour) |
void |
setMajorTickLength(int majorTickLength) |
void |
setMajorTickThickness(int majorTickThickness) |
void |
setMaxXValue(double maxXValue) |
void |
setMaxYValue(double maxYValue) |
void |
setMinorGridColour(Q minorGridColour) |
void |
setMinorGridThickness(int minorGridThickness) |
void |
setMinorTickColour(Q minorTickColour) |
void |
setMinorTickLength(int minorTickLength) |
void |
setMinorTickThickenss(int minorTickThickness) |
void |
setMinTickSpacing(int minTickSpacing) |
void |
setMinXValue(double minXValue) |
void |
setMinYValue(double minYValue) |
void |
setOrientation(double rads)
Set the orientation of the x axis
|
void |
setxAxisColour(Q xAxisColour) |
void |
setxAxisConfig(AxisConfig<Q> xAxisConfig) |
void |
setxAxisLabelTransformer(LabelTransformer xAxisLabelTransformer) |
void |
setxAxisName(String xAxisName) |
void |
setxAxisNameColour(Q xAxisNameColour) |
void |
setxAxisNameSize(int xAxisNameSize) |
void |
setxAxisPosition(double xAxisPosition) |
void |
setxAxisThickness(int xAxisThickness) |
void |
setxLabelSpacing(double xLabelSpacing) |
void |
setxMajorTickSpacing(double xMajorTickSpacing) |
void |
setxMinorTickSpacing(double xMinorTickSpacing) |
void |
setxTickLabelColour(Q xTickLabelColour) |
void |
setxTickLabelSize(int xTickLabelSize) |
void |
setyAxisColour(Q yAxisColour) |
void |
setyAxisConfig(AxisConfig<Q> yAxisConfig) |
void |
setyAxisLabelTransformer(LabelTransformer yAxisLabelTransformer) |
void |
setyAxisName(String yAxisName) |
void |
setyAxisNameColour(Q yAxisNameColour) |
void |
setyAxisNameSize(int yAxisNameSize) |
void |
setyAxisThickness(int yAxisThickness) |
void |
setyLabelSpacing(double yLabelSpacing) |
void |
setyMajorTickSpacing(double yMajorTickSpacing) |
void |
setyMinorTickSpacing(double yMinorTickSpacing) |
void |
setyTickLabelColour(Q yTickLabelColour) |
void |
setyTickLabelSize(int yTickLabelSize) |
public AxesRenderer2D()
public void setOrientation(double rads)
rads
- angle in radianspublic void renderAxis(I image)
image
- The image to draw the axes topublic void setDrawXAxis(boolean drawXAxis)
drawXAxis
- the drawXAxis to setpublic void setDrawYAxis(boolean drawYAxis)
drawYAxis
- the drawYAxis to setpublic int getAxisPaddingLeft()
public void setAxisPaddingLeft(int axisPaddingLeft)
axisPaddingLeft
- the axisPaddingLeft to setpublic int getAxisPaddingRight()
public void setAxisPaddingRight(int axisPaddingRight)
axisPaddingRight
- the axisPaddingRight to setpublic int getAxisPaddingTop()
public void setAxisPaddingTop(int axisPaddingTop)
axisPaddingTop
- the axisPaddingTop to setpublic int getAxisPaddingBottom()
public void setAxisPaddingBottom(int axisPaddingBottom)
axisPaddingBottom
- the axisPaddingBottom to setpublic void setxAxisPosition(double xAxisPosition)
xAxisPosition
- the xAxisPosition to setpublic double getxAxisPosition()
public boolean isAutoScaleAxes()
public void setAutoScaleAxes(boolean autoScaleAxes)
autoScaleAxes
- the autoScaleAxes to setpublic void setxAxisThickness(int xAxisThickness)
xAxisThickness
- the xAxisThickness to setpublic void setxAxisColour(Q xAxisColour)
xAxisColour
- the xAxisColour to setpublic void setyAxisThickness(int yAxisThickness)
yAxisThickness
- the yAxisThickness to setpublic void setyAxisColour(Q yAxisColour)
yAxisColour
- the yAxisColour to setpublic void setMaxXValue(double maxXValue)
maxXValue
- the maxXValue to setpublic void setMinXValue(double minXValue)
minXValue
- the minXValue to setpublic void setMaxYValue(double maxYValue)
maxYValue
- the maxYValue to setpublic double getMaxYValue()
public void setMinYValue(double minYValue)
minYValue
- the minYValue to setpublic void setxMinorTickSpacing(double xMinorTickSpacing)
xMinorTickSpacing
- the xMinorTickSpacing to setpublic void setyMinorTickSpacing(double yMinorTickSpacing)
yMinorTickSpacing
- the yMinorTickSpacing to setpublic void setxMajorTickSpacing(double xMajorTickSpacing)
xMajorTickSpacing
- the xMajorTickSpacing to setpublic void setyMajorTickSpacing(double yMajorTickSpacing)
yMajorTickSpacing
- the yMajorTickSpacing to setpublic void setMinorTickLength(int minorTickLength)
minorTickLength
- the minorTickLength to setpublic void setMajorTickLength(int majorTickLength)
majorTickLength
- the majorTickLength to setpublic void setMinorTickColour(Q minorTickColour)
minorTickColour
- the minorTickColour to setpublic void setMajorTickColour(Q majorTickColour)
majorTickColour
- the majorTickColour to setpublic void setMajorTickThickness(int majorTickThickness)
majorTickThickness
- the majorTickThickness to setpublic void setMinorTickThickenss(int minorTickThickness)
minorTickThickness
- the minorTickThickenss to setpublic void setDrawXTickLabels(boolean drawXTickLabels)
drawXTickLabels
- the drawXTickLabels to setpublic void setDrawYTickLabels(boolean drawYTickLabels)
drawYTickLabels
- the drawYTickLabels to setpublic void setxTickLabelSize(int xTickLabelSize)
xTickLabelSize
- the xTickLabelSize to setpublic void setxTickLabelColour(Q xTickLabelColour)
xTickLabelColour
- the xTickLabelColour to setpublic void setyTickLabelSize(int yTickLabelSize)
yTickLabelSize
- the yTickLabelSize to setpublic void setyTickLabelColour(Q yTickLabelColour)
yTickLabelColour
- the yTickLabelColour to setpublic void setAutoSpaceLabels(boolean autoSpaceLabels)
autoSpaceLabels
- the autoSpaceLabels to setpublic void setAutoSpaceTicks(boolean autoSpaceTicks)
autoSpaceTicks
- the autoSpaceTicks to setpublic void setMinTickSpacing(int minTickSpacing)
minTickSpacing
- the minTickSpacing to setpublic void setxLabelSpacing(double xLabelSpacing)
xLabelSpacing
- the xLabelSpacing to setpublic void setyLabelSpacing(double yLabelSpacing)
yLabelSpacing
- the yLabelSpacing to setpublic void setxAxisName(String xAxisName)
xAxisName
- the xAxisName to setpublic void setyAxisName(String yAxisName)
yAxisName
- the yAxisName to setpublic void setDrawYAxisName(boolean drawYAxisName)
drawYAxisName
- the drawYAxisName to setpublic void setDrawXAxisName(boolean drawXAxisName)
drawXAxisName
- the drawXAxisName to setpublic void setxAxisNameSize(int xAxisNameSize)
xAxisNameSize
- the xAxisNameSize to setpublic void setxAxisNameColour(Q xAxisNameColour)
xAxisNameColour
- the xAxisNameColour to setpublic void setyAxisNameSize(int yAxisNameSize)
yAxisNameSize
- the yAxisNameSize to setpublic void setyAxisNameColour(Q yAxisNameColour)
yAxisNameColour
- the yAxisNameColour to setpublic void setDrawXTicks(boolean drawXTicks)
drawXTicks
- the drawXTicks to setpublic void setDrawYTicks(boolean drawYTicks)
drawYTicks
- the drawYTicks to setpublic void setxAxisLabelTransformer(LabelTransformer xAxisLabelTransformer)
xAxisLabelTransformer
- the xAxisLabelTransformer to setpublic void setyAxisLabelTransformer(LabelTransformer yAxisLabelTransformer)
yAxisLabelTransformer
- the yAxisLabelTransformer to setpublic void setDrawMinorTickGrid(boolean drawMinorTickGrid)
drawMinorTickGrid
- the drawMinorTickGrid to setpublic void setDrawMajorTickGrid(boolean drawMajorTickGrid)
drawMajorTickGrid
- the drawMajorTickGrid to setpublic void setMinorGridColour(Q minorGridColour)
minorGridColour
- the minorGridColour to setpublic void setMajorGridColour(Q majorGridColour)
majorGridColour
- the majorGridColour to setpublic void setMajorGridThickness(int majorGridThickness)
majorGridThickness
- the majorGridThickness to setpublic void setMinorGridThickness(int minorGridThickness)
minorGridThickness
- the minorGridThickness to setpublic DataUnitsTransformer<Q,double[],int[]> getRelativePixelTransformer(int xOffset, int yOffset)
xOffset
- The x locationyOffset
- The y locationpublic AxisConfig<Q> getxAxisConfig()
public void setxAxisConfig(AxisConfig<Q> xAxisConfig)
xAxisConfig
- the xAxisConfig to setpublic AxisConfig<Q> getyAxisConfig()
public void setyAxisConfig(AxisConfig<Q> yAxisConfig)
yAxisConfig
- the yAxisConfig to setpublic int[] calculatePosition(double[] units)
calculatePosition
in interface DataUnitsTransformer<Q,double[],int[]>
units
- The unit to convert to render coordinatesDataUnitsTransformer.calculatePosition(java.lang.Object)
public double[] calculateUnitsAt(int[] position)
calculateUnitsAt
in interface DataUnitsTransformer<Q,double[],int[]>
position
- The data rendered position to convertDataUnitsTransformer.calculateUnitsAt(java.lang.Object)
public double[] scaleDimensions(double xs, double ys)
xs
- The x dimensionys
- The y dimensionpublic int[] scaleDimension(double[] dimension)
scaleDimension
in interface DataUnitsTransformer<Q,double[],int[]>
dimension
- The units/data dimensionDataUnitsTransformer.scaleDimension(java.lang.Object)
public Point2d calculatePosition(double x, double y)
x
- The data unit xy
- The data unit ypublic void precalc()
precalc
in interface DataUnitsTransformer<Q,double[],int[]>
DataUnitsTransformer.precalc()
public AxisRenderer2D<Q> getxAxisRenderer()
public AxisRenderer2D<Q> getyAxisRenderer()