Package com.oorian.chartjs
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
ConstructorsConstructorDescriptionChartJsComponent(String tagName, String componentType) Creates a new Chart.js component. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcallMethod(String methodName, Object... args) Calls a method on the client-side Chart.js instance.Gets the component type identifier.com.oorian.json.JsonObjectGets the configuration object for this component.protected voidprotected voidSets a configuration option on the Chart.js component.setHeight(int heightPx) Sets the height of the chart in pixels.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
-
Constructor Details
-
ChartJsComponent
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
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:
initializein classcom.oorian.html.Element<T extends ChartJsComponent<T>>
-
callMethod
Calls a method on the client-side Chart.js instance.- Parameters:
methodName- The name of the method to callargs- The arguments to pass to the method
-
setConfig
Sets a configuration option on the Chart.js component.- Parameters:
optionName- The name of the option to setvalue- The value to set
-
setWidth
Sets the width of the chart container.- Parameters:
width- The width value (e.g., "800px", "100%")- Returns:
- This component instance for method chaining
-
setWidth
Sets the width of the chart in pixels.- Parameters:
widthPx- The width in pixels- Returns:
- This component instance for method chaining
-
setHeight
Sets the height of the chart container.- Parameters:
height- The height value (e.g., "400px", "100%")- Returns:
- This component instance for method chaining
-
setHeight
Sets the height of the chart in pixels.- Parameters:
heightPx- The height in pixels- Returns:
- This component instance for method chaining
-