Class CjScales

java.lang.Object
com.oorian.chartjs.CjScales
All Implemented Interfaces:
com.oorian.json.Jsonable

public class CjScales extends Object implements com.oorian.json.Jsonable
Scale configuration for Chart.js axes.

Provides configuration for X, Y, and R (radial) axes using typed CjAxisConfig objects.

Usage with axis objects:


 CjScales scales = new CjScales()
     .setXAxis(new CjAxisConfig()
         .setType(ScaleType.CATEGORY)
         .setTitle("Month"))
     .setYAxis(new CjAxisConfig()
         .setBeginAtZero(true)
         .setMax(100)
         .setTitle("Sales"));
 

Usage with convenience methods:


 CjScales scales = new CjScales()
     .setXTitle("Month")
     .setYTitle("Sales")
     .setYBeginAtZero(true)
     .setYMax(100);
 
  • Constructor Details

    • CjScales

      public CjScales()
      Creates a new scales configuration.
  • Method Details

    • setXAxis

      public CjScales setXAxis(CjAxisConfig config)
      Sets the X-axis configuration.
      Parameters:
      config - The axis configuration
      Returns:
      This instance for method chaining
    • setYAxis

      public CjScales setYAxis(CjAxisConfig config)
      Sets the Y-axis configuration.
      Parameters:
      config - The axis configuration
      Returns:
      This instance for method chaining
    • setRAxis

      public CjScales setRAxis(CjAxisConfig config)
      Sets the R-axis (radial) configuration.
      Parameters:
      config - The axis configuration
      Returns:
      This instance for method chaining
    • setXType

      public CjScales setXType(ScaleType type)
      Sets the X-axis scale type.
      Parameters:
      type - The scale type
      Returns:
      This instance for method chaining
    • setXMin

      public CjScales setXMin(Number min)
      Sets the X-axis minimum value.
      Parameters:
      min - The minimum value
      Returns:
      This instance for method chaining
    • setXMax

      public CjScales setXMax(Number max)
      Sets the X-axis maximum value.
      Parameters:
      max - The maximum value
      Returns:
      This instance for method chaining
    • setXTitle

      public CjScales setXTitle(String title)
      Sets the X-axis title.
      Parameters:
      title - The axis title
      Returns:
      This instance for method chaining
    • setXTitleDisplay

      public CjScales setXTitleDisplay(boolean display)
      Sets whether to display the X-axis title.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setXGridDisplay

      public CjScales setXGridDisplay(boolean display)
      Sets whether to display the X-axis grid.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setXTicksDisplay

      public CjScales setXTicksDisplay(boolean display)
      Sets whether to display X-axis ticks.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setXStacked

      public CjScales setXStacked(boolean stacked)
      Sets whether to stack values on X-axis.
      Parameters:
      stacked - True to stack
      Returns:
      This instance for method chaining
    • setXReverse

      public CjScales setXReverse(boolean reverse)
      Sets whether to reverse the X-axis.
      Parameters:
      reverse - True to reverse
      Returns:
      This instance for method chaining
    • setXBeginAtZero

      public CjScales setXBeginAtZero(boolean beginAtZero)
      Sets whether X-axis should begin at zero.
      Parameters:
      beginAtZero - True to begin at zero
      Returns:
      This instance for method chaining
    • setYType

      public CjScales setYType(ScaleType type)
      Sets the Y-axis scale type.
      Parameters:
      type - The scale type
      Returns:
      This instance for method chaining
    • setYMin

      public CjScales setYMin(Number min)
      Sets the Y-axis minimum value.
      Parameters:
      min - The minimum value
      Returns:
      This instance for method chaining
    • setYMax

      public CjScales setYMax(Number max)
      Sets the Y-axis maximum value.
      Parameters:
      max - The maximum value
      Returns:
      This instance for method chaining
    • setYTitle

      public CjScales setYTitle(String title)
      Sets the Y-axis title.
      Parameters:
      title - The axis title
      Returns:
      This instance for method chaining
    • setYTitleDisplay

      public CjScales setYTitleDisplay(boolean display)
      Sets whether to display the Y-axis title.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setYGridDisplay

      public CjScales setYGridDisplay(boolean display)
      Sets whether to display the Y-axis grid.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setYTicksDisplay

      public CjScales setYTicksDisplay(boolean display)
      Sets whether to display Y-axis ticks.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setYStacked

      public CjScales setYStacked(boolean stacked)
      Sets whether to stack values on Y-axis.
      Parameters:
      stacked - True to stack
      Returns:
      This instance for method chaining
    • setYReverse

      public CjScales setYReverse(boolean reverse)
      Sets whether to reverse the Y-axis.
      Parameters:
      reverse - True to reverse
      Returns:
      This instance for method chaining
    • setYBeginAtZero

      public CjScales setYBeginAtZero(boolean beginAtZero)
      Sets whether Y-axis should begin at zero.
      Parameters:
      beginAtZero - True to begin at zero
      Returns:
      This instance for method chaining
    • setRMin

      public CjScales setRMin(Number min)
      Sets the R-axis (radial) minimum value.
      Parameters:
      min - The minimum value
      Returns:
      This instance for method chaining
    • setRMax

      public CjScales setRMax(Number max)
      Sets the R-axis (radial) maximum value.
      Parameters:
      max - The maximum value
      Returns:
      This instance for method chaining
    • setRBeginAtZero

      public CjScales setRBeginAtZero(boolean beginAtZero)
      Sets whether R-axis should begin at zero.
      Parameters:
      beginAtZero - True to begin at zero
      Returns:
      This instance for method chaining
    • getXAxis

      public CjAxisConfig getXAxis()
      Gets the X-axis configuration.
      Returns:
      The X-axis config, or null if not set
    • getYAxis

      public CjAxisConfig getYAxis()
      Gets the Y-axis configuration.
      Returns:
      The Y-axis config, or null if not set
    • getRAxis

      public CjAxisConfig getRAxis()
      Gets the R-axis configuration.
      Returns:
      The R-axis config, or null if not set
    • initFromJson

      public void initFromJson(com.oorian.json.JsonValue json)
      Specified by:
      initFromJson in interface com.oorian.json.Jsonable
    • toJsonValue

      public com.oorian.json.JsonValue toJsonValue()
      Specified by:
      toJsonValue in interface com.oorian.json.Jsonable