Package org.aesh.charts.axis
Class Axis
java.lang.Object
org.aesh.charts.axis.Axis
Renders a numeric axis with labels and tick marks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidautoRange(double dataMin, double dataMax) Auto-set min/max from data range with padding.doubledenormalize(double normalized) Map a normalized position (0.0-1.0) back to a data value.voiddrawXAxis(Canvas canvas, int xLeft, int xRight, int y, ChartStyle style) Draw a bottom X-axis on the canvas.voiddrawYAxis(Canvas canvas, int x, int yTop, int yBottom, ChartStyle style) Draw a left Y-axis on the canvas.formatTick(double value) Format a tick value as a label string.label()intCompute the width needed for Y-axis labels (max label width + 1 for tick mark).doublemax()max(double max) doublemin()min(double min) doublenormalize(double value) Map a data value to a normalized position (0.0 = min, 1.0 = max).scale()tickCount(int tickCount) double[]Generate tick values for this axis.
-
Constructor Details
-
Axis
public Axis()
-
-
Method Details
-
min
-
max
-
label
-
scale
-
tickCount
-
format
-
min
public double min() -
max
public double max() -
label
-
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
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
Draw a left Y-axis on the canvas.- Parameters:
canvas- the canvasx- x position of the axis lineyTop- top y positionyBottom- bottom y positionstyle- chart style
-
drawXAxis
Draw a bottom X-axis on the canvas.- Parameters:
canvas- the canvasxLeft- left x positionxRight- right x positiony- y position of the axis linestyle- chart style
-