Class ChartJsComponent<T extends ChartJsComponent<T>>

java.lang.Object
com.oorian.html.Element<T>
com.oorian.chartjs.ChartJsComponent<T>
Direct Known Subclasses:
CjChart

public abstract class ChartJsComponent<T extends ChartJsComponent<T>> extends com.oorian.html.Element<T>
Base class for all Chart.js components in the Oorian framework.

This class provides common functionality for Chart.js components including:

  • Configuration management via JsonObject
  • Client-side method invocation
  • Automatic initialization script generation
  • Dimension styling
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChartJsComponent(String tagName, String componentType)
    Creates a new Chart.js component.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    callMethod(String methodName, Object... args)
    Calls a method on the client-side Chart.js instance.
    Gets the component type identifier.
    com.oorian.json.JsonObject
    Gets the configuration object for this component.
    protected void
     
    protected void
    setConfig(String optionName, Object value)
    Sets a configuration option on the Chart.js component.
    setHeight(int heightPx)
    Sets the height of the chart in pixels.
    setHeight(String height)
    Sets the height of the chart container.
    setWidth(int widthPx)
    Sets the width of the chart in pixels.
    Sets the width of the chart container.

    Methods inherited from class com.oorian.html.Element

    addAttribute, addAttribute, addAttribute, addAttribute, addElement, addLineBreak, addLineOfText, addLineOfText, addLineOfText, addParagraph, addParagraph, addSpacer, addText, addText, addText, addText, assignId, containsElement, containsElement, create, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElement, getElementById, getElementCount, getElementCount, getElements, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, hasElements, hidden, insertElement, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onRemovedFromPage, onShown, onUpdated, onUserEvent, prewrite, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAllElements, removeAttribute, removeAttribute, removeElement, removeElement, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setElement, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setText, setText, setText, setText, setTranslate, shown, toString, unregisterListener, update, updateAttributes

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ChartJsComponent

      public ChartJsComponent(String tagName, String componentType)
      Creates a new Chart.js component.
      Parameters:
      tagName - The HTML tag name for this component (typically "canvas")
      componentType - The Chart.js component type identifier
  • Method Details

    • getComponentType

      public String getComponentType()
      Gets the component type identifier.
      Returns:
      The Chart.js component type
    • getConfig

      public com.oorian.json.JsonObject getConfig()
      Gets the configuration object for this component.
      Returns:
      The config JsonObject
    • initialize

      protected void initialize()
      Overrides:
      initialize in class com.oorian.html.Element<T extends ChartJsComponent<T>>
    • callMethod

      protected void callMethod(String methodName, Object... args)
      Calls a method on the client-side Chart.js instance.
      Parameters:
      methodName - The name of the method to call
      args - The arguments to pass to the method
    • setConfig

      protected void setConfig(String optionName, Object value)
      Sets a configuration option on the Chart.js component.
      Parameters:
      optionName - The name of the option to set
      value - The value to set
    • setWidth

      public T setWidth(String width)
      Sets the width of the chart container.
      Parameters:
      width - The width value (e.g., "800px", "100%")
      Returns:
      This component instance for method chaining
    • setWidth

      public T setWidth(int widthPx)
      Sets the width of the chart in pixels.
      Parameters:
      widthPx - The width in pixels
      Returns:
      This component instance for method chaining
    • setHeight

      public T setHeight(String height)
      Sets the height of the chart container.
      Parameters:
      height - The height value (e.g., "400px", "100%")
      Returns:
      This component instance for method chaining
    • setHeight

      public T setHeight(int heightPx)
      Sets the height of the chart in pixels.
      Parameters:
      heightPx - The height in pixels
      Returns:
      This component instance for method chaining