Class UIChart
- java.lang.Object
- com.iizix.prop.GProp<GProp<?>[]>
- com.iizix.prop.PropCnr
- com.iizix.prop.ui.UIComp
- com.iizix.prop.ui.chart.UIChart
- All Implemented Interfaces:
EventListener
,IMessageBox
,IComponent
,ICustomDataProvider
,IGProp<GProp<?>[]>
,IPropCnr
,IPropCnrChoiceSettings<IChartChoiceOption>
,IPropCnrColorSettings<ChartColor>
,IPropCnrFontSettings<ChartFont>
,IPropCnrIntegerSettings<ChartInteger>
,IPropCnrKStringSettings<ChartKString>
,IUIComp
,IUIContextMenuOwner
,IVSComponentListener
,IVSComponentState
,IVSFieldListener
,java.lang.Cloneable
- Direct Known Subclasses:
EUIChart
public class UIChart extends UIComp implements IPropCnrIntegerSettings<ChartInteger>, IPropCnrKStringSettings<ChartKString>, IPropCnrFontSettings<ChartFont>, IPropCnrColorSettings<ChartColor>, IPropCnrChoiceSettings<IChartChoiceOption>, IUIContextMenuOwner
Chart UI component.Chart Components: Plots, Axes, Series
Defining a basic chart and implementing its theme is quite simple. The real work comes in when defining plots, axes, and series. Each piece serves its own distinct, important purpose.
Plots
One of the main focuses of plots within charting is defining the type of chart to be added and providing values for the specific chart type's settings. The charting features numerous 2D charts including:
- Default - Universal line chart capable of rendering lines, fill areas under those lines, and placing markers at data points. This plot type is used if no plot type was specified when adding it to a chart.
- Lines - Basic line chart. Uses Default.
- Areas - Area under data line(s) will be filled. Uses Default.
- Markers - Lines with markers. Uses Default.
- MarkersOnly - Markers, sans lines. Uses Default.
- Stacked - Data sets charted in relation to the previous data set. Extension of Default.
- StackedLines - Stacked data sets using lines. Uses Stacked.
- StackedAreas - Stacked data sets with filled areas under chart lines. Uses Stacked.
- Bars - Horizontal bars.
- ClusteredBars - Horizontal bars with clustered data sets. Uses Bars.
- StackedBars - Stacked data sets with horizontal bars. Uses Bars.
- Columns - Vertical bars.
- ClusteredColumns - Vertical bars with clustered data sets. Uses Columns.
- StackedColumns - Stacked data sets with vertical bars. Uses Columns.
- Pie - The traditional pie chart.
- Scatter - Similar to MarkerOnly, yet capable of charting using gradient fields.
- Grid - For adding a grid layer to your chart.
Some of the standard plot options include:
- type - The chart type (Pie, Bars, Scatter, etc).
- lines - Represents if lines should be added within the chart.
- markers - Represents if markers should be added to data points within the chart.
- areas - Represents if areas within the chart should be shaded.
- shadows - Represents if shadows should be added to lines within the plot (ex: {dx:4, dy:4}).
- tension - Adds curves to lines within plots for added smoothness. Values can be:
X - Cubic bezier lines.
x - Similar to "X" but assumes that the point set is closed (a loop). It can be used when plotting true XY data.
S - Quadratic bezier lines. - gap - Represents the number of pixels between bars.
Each chart type may have its own custom options. The Pie plot type, for example, has a radius setting which defines the size of the chart's radius:
Axes
Most charts feature axes and many of those are the traditional x and y setup. An axis may be horizontal (the default) or vertical.
Some of the standard axis options include:
- fixUpper - Aligns chart ticks (can be "major", "minor", "micro", and "none").
- fixLower - Aligns chart ticks (can be "major", "minor", "micro", and "none").
- leftBottom - Determines the side of the chart the axis is placed (default is true).
- min - The minimum number an axis can start at.
- max - The maximum number an axis can end at.
Series
This element is simply a series of data to be rendered to the chart. A series is added to the chart with the addSeries method. The addSeries method accepts three arguments:
- name - The name of the series. Also represents the series label when the Legend plugin is used.
- data - The array of data.
- options An object containing series options, which may include:
stroke - Color and width of lines (ex: { color:"red", width: 2 }).
fill - Fill color of bar / line / pie piece.
Plugins:
- Legend: Charts often include legends to further clarify the data provided within the chart.
- Tooltip:
sheds light on values when hovering over marks and chart pieces, depending on the chart type. - Magnify and MoveSlide:
uses a touch of animation to react to the mouse's mouseover event. MoveSlice moves a pie chart piece and Magnify slightly enlarges chart markers. - Highlight: changes the color of an area when the mouse enters the area.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Nested classes/interfaces inherited from interface com.iizix.prop.vs.IVSComponentState
IVSComponentState.State
Field Summary
Fields inherited from class com.iizix.prop.ui.UIComp
EMPTY, REMOTE_FOCUS_EVENT, styles, vsField
Fields inherited from class com.iizix.prop.PropCnr
EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Fields inherited from interface com.iizix.gyro.IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNING
Fields inherited from interface com.iizix.prop.ui.IUIComp
ERROR, INFORMATION, NONE, WARNING
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UIChart
addAxis(Axis2D axis)
Adds a new axis to the chart.UIChart
addPlot(Plot2D plot)
Adds a new plot to the chart.UIChart
addSeries(Series series)
Adds a new series to the chart.boolean
canAlignX()
Returns if the component can be aligned left, right, center, or horizontal fill.boolean
canAlignY()
Returns if the component can be aligned top, bottom, middle or vertical fill.int
clearWindow(int duration)
Clears the zooms in or out any plots in two dimensions.UIChart
clone()
Creates a clone out of this property.protected KStringProp
createTitleProp()
Creates the title property a StringProp, KStringProp or PlainKStringProp depending on the component.Size
getApproximateSize()
Returns the size of the component in pixels.Axis2D[]
getAxes()
Gets all defined axes.Axis2D
getAxis(java.lang.String name)
Gets an axis by name.Plot2D
getDefaultPlot()
Gets the default plot of the chart.int
getDeviceType()
Gets the device type: -1=mobile, 0=both, 1=desktop.Plot2D
getPlot(java.lang.String name)
Gets a plot by name.Plot2D[]
getPlots()
Gets all defined plots.Series[]
getSeries()
Gets all defined series.Series
getSeries(java.lang.String name)
Gets a series by name.ChartTheme
getTheme()
Gets the chart theme.TitlePosition
getTitlePosition()
Gets the title position.boolean
hasImplicitAlignFillX()
Returns if the component has implicit component horizontal fill.boolean
hasImplicitAlignFillY()
Returns if the component has implicit component vertical fill.boolean
hasSeries(int vs)
Returns whether the chart contains data series with or without VS table connections.boolean
isAutoRendering()
Returns whether auto-rendering is enabled for the chart or not.boolean
isMobileContextMenuSupported()
Returns if the component can show the context menu in mobile mode.int
moveToBack(IChartContainer axisPlotOrSeries)
Moves an axis, plot or series to the back.int
moveToBack(java.lang.String name)
Moves an axis, plot or series to the back.int
moveToFront(IChartContainer axisPlotOrSeries)
Moves an axis, plot or series to the front.int
moveToFront(java.lang.String name)
Moves an axis, plot or series to the front.boolean
mustHaveHeight()
Does this component require a height?boolean
mustHaveWidth()
Does this component require a width?void
refresh()
Requests a refresh of the chart to update the data series from their respective VS tables and columns.boolean
removeAxis(Axis2D axis)
Removes an axis by reference.boolean
removeAxis(java.lang.String name)
Removes an axis by name.boolean
removePlot(Plot2D plot)
Removes a plot by reference.boolean
removePlot(java.lang.String name)
Removes a plot by name.boolean
removeSeries(Series series)
Removes a series by reference.boolean
removeSeries(java.lang.String name)
Removes a series by name.java.lang.String
render()
Renders the chart.boolean
setAutoRendering(boolean on)
Sets the auto-rendering flag.void
setTheme(ChartTheme theme)
Sets the chart theme.int
setWindow(double sx, double sy, double dx, double dy, int duration)
Zooms in or out any plots in two dimensions.boolean
usesPropIndex()
Checks if index is relevant for this container, e.g.java.lang.String
validate()
Validates the chart.int
zoomin(Axis2D axis, int start, int end)
Zooms in on an axis.boolean
zoomout()
Zooms out from any axis zoom-in.Methods inherited from class com.iizix.prop.ui.UIComp
add, addMappings, assignFontInfoResolver, canAcceptUIContainerFocus, canFillX, canFillY, canRequestFocus, canRequestFocus, clearErrorMessage, couldRequestFocusIfVirtualized, createStyles, disconnectVSField, enterVSProcessing, exitVSProcessing, fireSelection, fireSelection, forbiddenGetCustomDataMap, getBadge, getBestVSFieldValueType, getComponentID, getComponentMappings, getErrorMessage, getErrorMessage, getErrorMessageEx, getErrorMessageString, getErrorMessageString, getErrorMessageStringEx, getFirstContainerVSStateFocus, getFixHeight, getFixWidth, getFontInfo, getForcedAlignX, getForcedAlignY, getKStringText, getLayout, getLayoutMgr, getLayoutMgr, getMappedVSComponent, getMessage, getMessageText, getPixelHeight, getPixelWidth, getPredefinedProps, getSize, getStyles, getStyles, getText, getTitle, getTitleKS, getTitlePKS, getTooltip, getTooltipText, getTrigger, getUIPanel, getUIParent, getValue, getValue, getVirtualSpace, getVSField, getVSStateFocus, hasExplicitHeight, hasExplicitWidth, hasFocus, hasImplicitHeight, hasImplicitWidth, hasSelectionChanged, isEnabled, isMobile, isReadOnly, isRTL, isVisible, isVSFieldDisconnected, mustHaveExplicitHeight, mustHaveExplicitWidth, onBroken, onComponentSelectedInParent, onEventSelf, onFocusGained, onNotifySelectionChanged, onParentStateChanged, onPrepare, onPrepare, onPropDispose, onRemoteEvent, onResolved, onSelectionChanged, onStateChanged, onValueChanged, onVirtualizationCompleted, processVSComponentSelection, reconnectVSField, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusEx, requestFocusEx, requestFocusEx, requestFocusEx, resetComponentID, setBadge, setBadge, setComponentToVSField, setEnabled, setEnabled, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setHTMLText, setLayoutMgr, setMessage, setMessage, setReadOnly, setReadOnly, setText, setText, setTitle, setTitle, setTitle, setTooltip, setTooltip, setUIContainerFocus, setVisible, setVisible, setVSFieldMessageToComponent, setVSFieldToComponent, verify, verifyComponentScope
Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, completeVirtualize, containsProp, containsProp, convertLoadedProp, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, doVirtualizePropCnr, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getReferences, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isSibling, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onVirtualized, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.IComponent
messageBox
Methods inherited from interface com.iizix.prop.ICustomDataProvider
getCustomData, putCustomData, putCustomDataIfAbsent
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropBaseReference, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getReferences, getRelativePropName, getRootParent, getTreeLock, getValueClasses, getVSReference, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, list, list, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPropTreeInitialized, onRemoteEvent, removePropError, removePropListener, renameProp, resolveRuntimeReferences, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toElementString, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, validatePropType, validatePropValue, verify, verifyHasPropertyItem, warning, warning, warning
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox
Methods inherited from interface com.iizix.prop.IPropCnr
addProp, addProp, addProp2, addProp2, canRequestFocus, canRequestFocus, canRequestFocus, containsProp, containsProp, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, enablePropCommunication, enablePropHashMap, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsError, getExtendsName, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropCnr, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getString, getString, getString, getString, hasFocus, initializeExtendsFramework, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsRoot, isPropAddRemoveAllowed, isPropExtended, isSibling, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, requestFocus, requestFocusEx, setBool, setBool, setBool, setBool, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, usePropHashMap, validateClassInstances
Methods inherited from interface com.iizix.prop.IPropCnrChoiceSettings
set
Methods inherited from interface com.iizix.prop.IPropCnrColorSettings
get, getNoDefault, set
Methods inherited from interface com.iizix.prop.IPropCnrFontSettings
get, getNoDefault, set
Methods inherited from interface com.iizix.prop.IPropCnrIntegerSettings
get, set
Methods inherited from interface com.iizix.prop.IPropCnrKStringSettings
get, getNoDefault, set, set
Methods inherited from interface com.iizix.prop.ui.IUIComp
getContainerFirstUIComponent, getContainerFirstUIComponentNull, getFirstUIComponent, getFirstUIComponentNull, getPanelUIComponent, getPanelUIComponentNull, getUIRef
Methods inherited from interface com.iizix.prop.ui.IUIContextMenuOwner
getContainedContextMenu, getContextMenu, getReferencedContextMenu, isContextMenuSupported, onBroken, onResolved
Constructor Detail
UIChart
public UIChart()
Creates the component without a name. The name must be set in all cases using thesetPropertyAtom
call.
UIChart
public UIChart(Atom propertyAtom)
Creates the component with the specified name. All system-reserved names for components begins with "$".- Parameters:
propertyAtom
- the name of the component, unique within it's parent.
Method Detail
clone
public UIChart clone()
Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.
usesPropIndex
public final boolean usesPropIndex()
Checks if index is relevant for this container, e.g. to keep the Z-ordering of components.- Specified by:
usesPropIndex
in interfaceIPropCnr
- Overrides:
usesPropIndex
in classPropCnr
- Returns:
- true, the chart is index-sensitive.
getDeviceType
public final int getDeviceType()
Gets the device type: -1=mobile, 0=both, 1=desktop.- Specified by:
getDeviceType
in interfaceIUIComp
- Returns:
- 0=both desktop and mobile support.
isMobileContextMenuSupported
public boolean isMobileContextMenuSupported()
Returns if the component can show the context menu in mobile mode.- Specified by:
isMobileContextMenuSupported
in interfaceIUIContextMenuOwner
- Returns:
- Chart support context menus for mobile.
mustHaveWidth
public boolean mustHaveWidth()
Does this component require a width?- Overrides:
mustHaveWidth
in classUIComp
- Returns:
- true, always.
mustHaveHeight
public boolean mustHaveHeight()
Does this component require a height?- Overrides:
mustHaveHeight
in classUIComp
- Returns:
- true, always.
hasImplicitAlignFillX
public boolean hasImplicitAlignFillX()
Returns if the component has implicit component horizontal fill.- Overrides:
hasImplicitAlignFillX
in classUIComp
- Returns:
- Always true: true means component will always fill the space in X.
hasImplicitAlignFillY
public boolean hasImplicitAlignFillY()
Returns if the component has implicit component vertical fill.- Overrides:
hasImplicitAlignFillY
in classUIComp
- Returns:
- Always: true means component will always fill the space in Y.
canAlignX
public boolean canAlignX()
Returns if the component can be aligned left, right, center, or horizontal fill.
canAlignY
public boolean canAlignY()
Returns if the component can be aligned top, bottom, middle or vertical fill.
createTitleProp
protected KStringProp createTitleProp()
Creates the title property a StringProp, KStringProp or PlainKStringProp depending on the component.- Overrides:
createTitleProp
in classUIComp
- Returns:
- A new KStringProp named Atom.TITLE.
getTheme
public ChartTheme getTheme()
Gets the chart theme.- Returns:
- The chart theme.
setTheme
public void setTheme(ChartTheme theme)
Sets the chart theme. Null means default theme.- Parameters:
theme
- The chart theme.
getTitlePosition
public TitlePosition getTitlePosition()
Gets the title position.- Returns:
- The title position.
addAxis
public UIChart addAxis(Axis2D axis) throws PropException
Adds a new axis to the chart.Calling this method turns off auto-rendering and you must complete chart rendering with
{link @#render()}
.- Parameters:
axis
- The axis instance.- Returns:
this
instance for concatenation use.- Throws:
PropException
- If the axis already exists, or if the name is taken.
getAxis
public Axis2D getAxis(java.lang.String name)
Gets an axis by name.- Parameters:
name
- The name of the axis.- Returns:
- The instance of the axis, or null if not found.
getAxes
public Axis2D[] getAxes()
Gets all defined axes.- Returns:
- The axes array in the current order (the top-most axis is the first).
removeAxis
public boolean removeAxis(java.lang.String name) throws PropException
Removes an axis by name.- Parameters:
name
- The name of the axis.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
removeAxis
public boolean removeAxis(Axis2D axis) throws PropException
Removes an axis by reference.- Parameters:
axis
- The axis instance.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
getDefaultPlot
public Plot2D getDefaultPlot()
Gets the default plot of the chart. This instance MUST be present in order for the chart to be rendered. If it has been removed, the chart will be in error state.- Returns:
- The default plot, or null if it is not yet added or has been removed.
addPlot
public UIChart addPlot(Plot2D plot) throws PropException
Adds a new plot to the chart.Calling this method turns off auto-rendering and you must complete chart rendering with
{link @#render()}
.- Parameters:
plot
- The plot instance.- Returns:
this
instance for concatenation use.- Throws:
PropException
- If the plot already exists, or if the name is taken.
getPlot
public Plot2D getPlot(java.lang.String name)
Gets a plot by name.- Parameters:
name
- The name of the plot.- Returns:
- The instance of the plot, or null if not found.
getPlots
public Plot2D[] getPlots()
Gets all defined plots.- Returns:
- The plot array in the current order (the top-most plot is the first).
removePlot
public boolean removePlot(java.lang.String name) throws PropException
Removes a plot by name.- Parameters:
name
- The name of the plot.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
removePlot
public boolean removePlot(Plot2D plot) throws PropException
Removes a plot by reference.- Parameters:
plot
- The plot instance.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
addSeries
public UIChart addSeries(Series series) throws PropException
Adds a new series to the chart.Calling this method turns off auto-rendering and you must complete chart rendering with
{link @#render()}
.- Parameters:
series
- The series instance.- Returns:
this
instance for concatenation use.- Throws:
PropException
- If the series already exists, or if the name is taken.
getSeries
public Series getSeries(java.lang.String name)
Gets a series by name.- Parameters:
name
- The name of the series.- Returns:
- The instance of the series, or null if not found.
getSeries
public Series[] getSeries()
Gets all defined series.- Returns:
- The series array in the current order (the top-most series is the first).
removeSeries
public boolean removeSeries(java.lang.String name) throws PropException
Removes a series by name.- Parameters:
name
- The name of the series.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
removeSeries
public boolean removeSeries(Series series) throws PropException
Removes a series by reference.- Parameters:
series
- The series instance.- Returns:
- true for success, false for failure.
- Throws:
PropException
- In case of property errors such as read-only chart property.
hasSeries
public boolean hasSeries(int vs)
Returns whether the chart contains data series with or without VS table connections.- Parameters:
vs
- The VS connection check: -1 = all data series, 0 = only without VS tables, 1 = only with VS tables.- Returns:
- true if there are data series with the matching VS connection check flag.
moveToFront
public final int moveToFront(java.lang.String name) throws PropException
Moves an axis, plot or series to the front.- Parameters:
name
- The name of the axis, plot or series.- Returns:
- 1 for success and change to chart, zero for success but no change, -1 if not found.
- Throws:
PropException
- In case of property errors such as read-only chart property.
moveToFront
public final int moveToFront(IChartContainer axisPlotOrSeries) throws PropException
Moves an axis, plot or series to the front.- Parameters:
axisPlotOrSeries
- Axis, plot or series to move.- Returns:
- 1 for success and change to chart, zero for success but no change, -1 if not found.
- Throws:
PropException
- In case of property errors such as read-only chart property.
moveToBack
public final int moveToBack(java.lang.String name) throws PropException
Moves an axis, plot or series to the back.- Parameters:
name
- The name of the axis, plot or series.- Returns:
- 1 for success and change to chart, zero for success but no change, -1 if not found.
- Throws:
PropException
- In case of property errors such as read-only chart property.
moveToBack
public final int moveToBack(IChartContainer axisPlotOrSeries) throws PropException
Moves an axis, plot or series to the back.- Parameters:
axisPlotOrSeries
- The axis, plot or series to move.- Returns:
- 1 for success and change to chart, zero for success but no change, -1 if not found.
- Throws:
PropException
- In case of property errors such as read-only chart property.
validate
public java.lang.String validate()
Validates the chart.- Returns:
- null for success, otherwise the first error message.
isAutoRendering
public boolean isAutoRendering()
Returns whether auto-rendering is enabled for the chart or not.If not auto-rendered, you MUST call the
{link @#render()}
method in order to visualize the chart (or its changes).If auto-rendered, the chart is rendered immediately upon creation, or for changes with a delay of 300 ms since the last update to the chart or any of its settings, plot, axis, series or values.
If auto-rendering is on, you may still call the
{link @#render()}
method in order to perform an immediate rendering.- Returns:
- The auto-render flag.
setAutoRendering
public boolean setAutoRendering(boolean on)
Sets the auto-rendering flag.If not auto-rendered, you MUST call the
{link @#render()}
method in order to visualize the chart (or its changes).If auto-rendered, the chart is rendered immediately upon creation, or for changes with a delay of 300 ms since the last update to the chart or any of its settings, plot, axis, series or values.
If auto-rendering is on, you may still call the
{link @#render()}
method in order to perform an immediate rendering.- Parameters:
on
- The auto-rendering flag.- Returns:
- The auto-render flag.
render
public java.lang.String render()
Renders the chart. Before rendering, validation is performed in order to check the chart state and a potential error is returned rather than rendering the chart.- Returns:
- null for success, otherwise the error message.
zoomin
public int zoomin(Axis2D axis, int start, int end)
Zooms in on an axis.- Parameters:
axis
- The axis instance.start
- The start point measured in axis ticks.end
- The end point measured in axis ticks.- Returns:
- 1 for success, zero for no change or -1 for failure.
zoomout
public boolean zoomout()
Zooms out from any axis zoom-in.- Returns:
- true for success, false for no change.
setWindow
public int setWindow(double sx, double sy, double dx, double dy, int duration)
Zooms in or out any plots in two dimensions.- Parameters:
sx
- The scale for the x axis (greater than zero).sy
- The scale for the y axis (greater than zero).dx
- The pixel offset on the x axis.dy
- The pixel offset on the y axis.duration
- Duration for the chart zooming animation trigger, zero for none, otherwise a value in milliseconds e.g. 1200.- Returns:
- 1 for success, zero for no change or -1 for failure (sx/sy less or equal to zero, duration negative).
clearWindow
public int clearWindow(int duration)
Clears the zooms in or out any plots in two dimensions.- Parameters:
duration
- Duration for the chart zooming animation trigger, zero for none, otherwise a value in milliseconds e.g. 1200.- Returns:
- 1 for success, zero for no change or -1 for failure (duration negative).
getApproximateSize
public Size getApproximateSize()
Returns the size of the component in pixels. The size is a calculation and does not exactly reflect the real size that may be different due to additional styles not taken into account by this method. The size is calculated from the font of the component and default or defined values (such as character length or number of lines for text area).- Specified by:
getApproximateSize
in classUIComp
- Returns:
- The size of the component: 400x300.
refresh
public void refresh()
Requests a refresh of the chart to update the data series from their respective VS tables and columns.The series are not refreshed upon returning from the call, it is done at a later stage.