Class AxisConfig

java.lang.Object
com.arbergashi.charts.api.AxisConfig

public final class AxisConfig extends Object
Axis configuration.

Provides formatting and behavior flags for axis rendering.

Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Constructor Details

    • AxisConfig

      public AxisConfig()
  • Method Details

    • formatValue

      public String formatValue(double value)
      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

      public AxisConfig setShowGrid(boolean showGrid)
      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

      public AxisConfig setRequestedTickCount(int count)
      Sets the requested tick count for this axis.
      Parameters:
      count - desired tick count
      Returns:
      this config for chaining
    • setTicks

      public AxisConfig setTicks(int count)
      Parameters:
      count - desired tick count
      Returns:
      this config for chaining
    • getLabelFormatPattern

      public String getLabelFormatPattern()
      Retrieves the label format pattern for the axis.
      Returns:
      the label format pattern, or null if not set.
    • setLabelFormatPattern

      public AxisConfig setLabelFormatPattern(String pattern)
      Sets the label format pattern for axis values.
      Parameters:
      pattern - DecimalFormat pattern (null clears the pattern)
      Returns:
      this config for chaining
    • getUnitSuffix

      public String getUnitSuffix()
      Retrieves the unit suffix for the axis.
      Returns:
      the unit suffix, or an empty string if not set.
    • setUnitSuffix

      public AxisConfig setUnitSuffix(String unitSuffix)
      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

      public AxisConfig setAutoScale(boolean autoScale)
      Enables or disables auto-scaling for this axis.
      Parameters:
      autoScale - true to enable auto-scaling
      Returns:
      this config for chaining
    • setFixedRange

      public AxisConfig setFixedRange(double min, double max)
      Sets a fixed data range for the axis.
      Parameters:
      min - fixed minimum value
      max - fixed maximum value
      Returns:
      this config for chaining
    • hasFixedRange

      public boolean hasFixedRange()
      Returns whether a fixed range is configured.
    • getFixedMin

      public Double getFixedMin()
      Returns the fixed minimum value if configured.
    • getFixedMax

      public Double getFixedMax()
      Returns the fixed maximum value if configured.
    • setUnitsPerPixel

      public AxisConfig setUnitsPerPixel(Double unitsPerPixel)
      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

      public Double getUnitsPerPixel()
      Returns the configured units per pixel, or null if not set.
    • medicalScale

      public AxisConfig medicalScale(double mmPerUnit)
      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

      public AxisConfig setInverted(boolean inverted)
      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

      public AxisConfig setLocale(Locale locale)
      Sets the locale for the axis.
      Parameters:
      locale - the locale to use for formatting
      Returns:
      this
    • getLocale

      public Locale getLocale()
      Returns the locale used for formatting.
      Returns:
      locale for number formatting