Class CjAxisConfig

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

public class CjAxisConfig extends Object implements com.oorian.json.Jsonable
Configuration for a single axis in Chart.js charts.

Usage:


 CjAxisConfig xAxis = new CjAxisConfig()
     .setType(ScaleType.LINEAR)
     .setMin(0)
     .setMax(100)
     .setTitle("X Axis")
     .setBeginAtZero(true);
 
  • Constructor Details

    • CjAxisConfig

      public CjAxisConfig()
      Creates a new axis configuration.
  • Method Details

    • setType

      public CjAxisConfig setType(ScaleType type)
      Sets the scale type.
      Parameters:
      type - The scale type
      Returns:
      This instance for method chaining
    • setMin

      public CjAxisConfig setMin(Number min)
      Sets the minimum value.
      Parameters:
      min - The minimum value
      Returns:
      This instance for method chaining
    • setMax

      public CjAxisConfig setMax(Number max)
      Sets the maximum value.
      Parameters:
      max - The maximum value
      Returns:
      This instance for method chaining
    • setBeginAtZero

      public CjAxisConfig setBeginAtZero(boolean beginAtZero)
      Sets whether the axis should begin at zero.
      Parameters:
      beginAtZero - True to begin at zero
      Returns:
      This instance for method chaining
    • setStacked

      public CjAxisConfig setStacked(boolean stacked)
      Sets whether values are stacked.
      Parameters:
      stacked - True to stack
      Returns:
      This instance for method chaining
    • setReverse

      public CjAxisConfig setReverse(boolean reverse)
      Sets whether the axis is reversed.
      Parameters:
      reverse - True to reverse
      Returns:
      This instance for method chaining
    • setDisplay

      public CjAxisConfig setDisplay(boolean display)
      Sets whether the axis is displayed.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setTitle

      public CjAxisConfig setTitle(String title)
      Sets the axis title text.
      Parameters:
      title - The title text
      Returns:
      This instance for method chaining
    • setTitleDisplay

      public CjAxisConfig setTitleDisplay(boolean display)
      Sets whether to display the title.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setTitleColor

      public CjAxisConfig setTitleColor(String color)
      Sets the title color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTitleFont

      public CjAxisConfig setTitleFont(String size, String weight)
      Sets the title font.
      Parameters:
      size - The font size (e.g., "14", "16px")
      weight - The font weight (e.g., "bold", "normal")
      Returns:
      This instance for method chaining
    • setGridDisplay

      public CjAxisConfig setGridDisplay(boolean display)
      Sets whether to display grid lines.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setGridColor

      public CjAxisConfig setGridColor(String color)
      Sets the grid line color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setGridLineWidth

      public CjAxisConfig setGridLineWidth(int width)
      Sets the grid line width.
      Parameters:
      width - The line width in pixels
      Returns:
      This instance for method chaining
    • setTicksDisplay

      public CjAxisConfig setTicksDisplay(boolean display)
      Sets whether to display tick marks.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setTicksColor

      public CjAxisConfig setTicksColor(String color)
      Sets the tick label color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTicksFontSize

      public CjAxisConfig setTicksFontSize(int size)
      Sets the tick label font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • getType

      public ScaleType getType()
    • getMin

      public Number getMin()
    • getMax

      public Number getMax()
    • getBeginAtZero

      public Boolean getBeginAtZero()
    • getStacked

      public Boolean getStacked()
    • getReverse

      public Boolean getReverse()
    • getDisplay

      public Boolean getDisplay()
    • getTitle

      public String getTitle()
    • getTitleDisplay

      public Boolean getTitleDisplay()
    • getTitleColor

      public String getTitleColor()
    • getGridDisplay

      public Boolean getGridDisplay()
    • getGridColor

      public String getGridColor()
    • getGridLineWidth

      public Integer getGridLineWidth()
    • getTicksDisplay

      public Boolean getTicksDisplay()
    • getTicksColor

      public String getTicksColor()
    • getTicksFontSize

      public Integer getTicksFontSize()
    • 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
    • hasValues

      public boolean hasValues()
      Checks if this configuration has any values set.
      Returns:
      True if any property is set