Class CjChartOptions

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

public class CjChartOptions extends Object implements com.oorian.json.Jsonable
Options configuration for Chart.js charts.

Contains all chart options including responsive behavior, interaction, animation, scales, and plugins.

Usage:


 CjChartOptions options = new CjChartOptions()
     .setResponsive(true)
     .setMaintainAspectRatio(false)
     .setInteraction(new CjInteractionConfig()
         .setMode(InteractionMode.INDEX))
     .setScales(new CjScales()
         .setYBeginAtZero(true));
 
  • Constructor Details

    • CjChartOptions

      public CjChartOptions()
      Creates a new chart options configuration.
  • Method Details

    • setResponsive

      public CjChartOptions setResponsive(boolean responsive)
      Sets whether the chart is responsive.
      Parameters:
      responsive - True for responsive sizing
      Returns:
      This instance for method chaining
    • setMaintainAspectRatio

      public CjChartOptions setMaintainAspectRatio(boolean maintain)
      Sets whether to maintain aspect ratio.
      Parameters:
      maintain - True to maintain aspect ratio
      Returns:
      This instance for method chaining
    • setAspectRatio

      public CjChartOptions setAspectRatio(double ratio)
      Sets the aspect ratio.
      Parameters:
      ratio - The aspect ratio (width/height)
      Returns:
      This instance for method chaining
    • setIndexAxis

      public CjChartOptions setIndexAxis(IndexAxis axis)
      Sets the index axis for horizontal bar charts.
      Parameters:
      axis - The index axis (X for vertical, Y for horizontal)
      Returns:
      This instance for method chaining
    • setInteraction

      public CjChartOptions setInteraction(CjInteractionConfig interaction)
      Sets the interaction configuration.
      Parameters:
      interaction - The interaction configuration
      Returns:
      This instance for method chaining
    • setHover

      public CjChartOptions setHover(CjInteractionConfig hover)
      Sets the hover configuration.
      Parameters:
      hover - The hover configuration
      Returns:
      This instance for method chaining
    • setAnimation

      public CjChartOptions setAnimation(CjAnimationConfig animation)
      Sets the animation configuration.
      Parameters:
      animation - The animation configuration
      Returns:
      This instance for method chaining
    • setScales

      public CjChartOptions setScales(CjScales scales)
      Sets the scales configuration.
      Parameters:
      scales - The scales configuration
      Returns:
      This instance for method chaining
    • setPlugins

      public CjChartOptions setPlugins(CjPlugins plugins)
      Sets the plugins configuration.
      Parameters:
      plugins - The plugins configuration
      Returns:
      This instance for method chaining
    • getResponsive

      public Boolean getResponsive()
    • getMaintainAspectRatio

      public Boolean getMaintainAspectRatio()
    • getAspectRatio

      public Double getAspectRatio()
    • getIndexAxis

      public IndexAxis getIndexAxis()
    • getInteraction

      public CjInteractionConfig getInteraction()
    • getHover

      public CjInteractionConfig getHover()
    • getAnimation

      public CjAnimationConfig getAnimation()
    • getScales

      public CjScales getScales()
    • getPlugins

      public CjPlugins getPlugins()
    • 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