Class AxisConfig
java.lang.Object
com.arbergashi.charts.api.AxisConfig
Axis configuration.
Provides formatting and behavior flags for axis rendering.
- Since:
- 2026-01-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformatValue(double value) Formats an axis value based on the selected pattern and locale.Returns the fixed maximum value if configured.Returns the fixed minimum value if configured.Retrieves the label format pattern for the axis.Returns the locale used for formatting.intRetrieves the requested tick count for the axis.Returns the configured units per pixel, or null if not set.Retrieves the unit suffix for the axis.booleanReturns whether a fixed range is configured.booleanDetermines whether the axis should automatically adjust its scale based on data.booleanReturns whether this axis is inverted.booleanDetermines whether the grid is displayed on the axis.medicalScale(double mmPerUnit) Convenience for medical/physical scaling.setAutoScale(boolean autoScale) Enables or disables auto-scaling for this axis.setFixedRange(double min, double max) Sets a fixed data range for the axis.setInverted(boolean inverted) Sets whether this axis is inverted.setLabelFormatPattern(String pattern) Sets the label format pattern for axis values.Sets the locale for the axis.setRequestedTickCount(int count) Sets the requested tick count for this axis.setShowGrid(boolean showGrid) Enables or disables grid rendering for this axis.setTicks(int count) Alias forsetRequestedTickCount(int).setUnitsPerPixel(Double unitsPerPixel) Sets the data units per pixel for a fixed physical scale (e.g., mm/s).setUnitSuffix(String unitSuffix) Sets the unit suffix appended to formatted values.
-
Constructor Details
-
AxisConfig
public AxisConfig()
-
-
Method Details
-
formatValue
Formats an axis value based on the selected pattern and locale.- Parameters:
value- The value to format.- Returns:
- The formatted value as a string.
-
isShowGrid
public boolean isShowGrid()Determines whether the grid is displayed on the axis.- Returns:
- true if the grid is enabled and should be displayed; false otherwise.
-
setShowGrid
Enables or disables grid rendering for this axis.- Parameters:
showGrid- true to show the grid- Returns:
- this config for chaining
-
getRequestedTickCount
public int getRequestedTickCount()Retrieves the requested tick count for the axis.- Returns:
- the requested tick count, or 0 if not set.
-
setRequestedTickCount
Sets the requested tick count for this axis.- Parameters:
count- desired tick count- Returns:
- this config for chaining
-
setTicks
Alias forsetRequestedTickCount(int).- Parameters:
count- desired tick count- Returns:
- this config for chaining
-
getLabelFormatPattern
Retrieves the label format pattern for the axis.- Returns:
- the label format pattern, or null if not set.
-
setLabelFormatPattern
Sets the label format pattern for axis values.- Parameters:
pattern- DecimalFormat pattern (null clears the pattern)- Returns:
- this config for chaining
-
getUnitSuffix
Retrieves the unit suffix for the axis.- Returns:
- the unit suffix, or an empty string if not set.
-
setUnitSuffix
Sets the unit suffix appended to formatted values.- Parameters:
unitSuffix- unit suffix (null becomes empty)- Returns:
- this config for chaining
-
isAutoScale
public boolean isAutoScale()Determines whether the axis should automatically adjust its scale based on data.- Returns:
- true if auto-scaling is enabled; false otherwise.
-
setAutoScale
Enables or disables auto-scaling for this axis.- Parameters:
autoScale- true to enable auto-scaling- Returns:
- this config for chaining
-
setFixedRange
Sets a fixed data range for the axis.- Parameters:
min- fixed minimum valuemax- fixed maximum value- Returns:
- this config for chaining
-
hasFixedRange
public boolean hasFixedRange()Returns whether a fixed range is configured. -
getFixedMin
Returns the fixed minimum value if configured. -
getFixedMax
Returns the fixed maximum value if configured. -
setUnitsPerPixel
Sets the data units per pixel for a fixed physical scale (e.g., mm/s). A null value disables fixed scale behavior.- Parameters:
unitsPerPixel- data units per pixel- Returns:
- this config for chaining
-
getUnitsPerPixel
Returns the configured units per pixel, or null if not set. -
medicalScale
Convenience for medical/physical scaling. This sets units-per-pixel using a mm-per-unit ratio (e.g., 25 mm/s or 10 mm/mV).- Parameters:
mmPerUnit- millimeters per data unit- Returns:
- this config for chaining
-
setInverted
Sets whether this axis is inverted.- Parameters:
inverted- true to invert the axis direction- Returns:
- this config for chaining
-
isInverted
public boolean isInverted()Returns whether this axis is inverted. -
setLocale
Sets the locale for the axis.- Parameters:
locale- the locale to use for formatting- Returns:
- this
-
getLocale
Returns the locale used for formatting.- Returns:
- locale for number formatting
-