Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Slots
JET elements can have up to two types of child content:
- Any child element with a
slotattribute will be moved into that named slot, e.g.<span slot='startIcon'>...</span>. All supported named slots are documented below. Child elements with unsupported named slots will be removed from the DOM. - Any child element lacking a
slotattribute will be moved to the default slot, also known as a regular child.
-
contextMenu
-
The contextMenu slot is set on the
oj-menuwithin this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.
To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc and demos of the individual components for details.
Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.
Example
Initialize the component with a context menu:
<oj-some-element> <-- use the contextMenu slot to designate this as the context menu for this component --> <oj-menu slot="contextMenu" style="display:none" aria-label="Some element's context menu"> ... </oj-menu> </oj-some-element> -
itemTemplate
PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.
-
The
itemTemplateslot is used to specify the template for creating each item of the tag cloud. The slot must be a <template> element.When the template is executed for each item, it will have access to the tag cloud's binding context and the following properties:
- $current - an object that contains information for the current item
- alias - if as attribute was specified, the value will be used to provide an application-named alias for $current.
The content of the template should only be one <oj-tag-cloud-item> element. See the oj-tag-cloud-item doc for more details.
Properties of $current:
Name Type Description componentElementElement The <oj-tag-cloud> custom element. dataObject The data object for the current item. indexnumber The zero-based index of the current item. keyany The key of the current item. Example
Initialize the tag cloud with an inline item template specified:
<oj-tag-cloud data='[[dataProvider]]'> <template slot='itemTemplate'> <oj-tag-cloud-item value='[[$current.item.value]]' label='[[$current.item.label]]'> </oj-tag-cloud-item> </template> </oj-tag-cloud>
Attributes
-
animation-on-data-change :string
-
Defines the animation that is applied on data changes.
- Default Value:
"none"
Supported Values:
Name Type "auto"string "none"string Names
Item Name Property animationOnDataChangeProperty change event animationOnDataChangeChangedProperty change listener attribute (must be of type function) on-animation-on-data-change-changedExamples
Initialize the tag cloud with the
animation-on-data-changeattribute specified:<oj-tag-cloud animation-on-data-change='auto'></oj-tag-cloud>Get or set the
animationOnDataChangeproperty after initialization:// getter var value = myTagCloud.animationOnDataChange; // setter myTagCloud.animationOnDataChange="auto"; -
animation-on-display :string
-
Defines the animation that is shown on initial display.
- Default Value:
"none"
Supported Values:
Name Type "auto"string "none"string Names
Item Name Property animationOnDisplayProperty change event animationOnDisplayChangedProperty change listener attribute (must be of type function) on-animation-on-display-changedExamples
Initialize the tag cloud with the
animation-on-displayattribute specified:<oj-tag-cloud animation-on-display='auto'></oj-tag-cloud>Get or set the
animationOnDisplayproperty after initialization:// getter var value = myTagCloud.animationOnDisplay; // setter myTagCloud.animationOnDisplay="auto"; -
as :string
-
An alias for the $current context variable when referenced inside itemTemplate when using a DataProvider.
- Default Value:
''
Names
Item Name Property asProperty change event asChangedProperty change listener attribute (must be of type function) on-as-changed -
data :oj.DataProvider|null
-
The oj.DataProvider for the tag cloud. It should provide rows where each row corresponds to a single tag cloud item.
- Default Value:
null
Names
Item Name Property dataProperty change event dataChangedProperty change listener attribute (must be of type function) on-data-changedExamples
Initialize the tag cloud with the
dataattribute specified:<oj-tag-cloud data='[[dataProvider]]'></oj-tag-cloud>Get or set the
dataproperty after initialization:// getter var value = myTagCloud.data; // setter myTagCloud.data = dataProvider; -
hidden-categories :Array.<string>
-
An array of category strings used for category filtering. Data items with a category in hiddenCategories will be filtered.
- Default Value:
[]
- Supports writeback:
true
Names
Item Name Property hiddenCategoriesProperty change event hiddenCategoriesChangedProperty change listener attribute (must be of type function) on-hidden-categories-changedExamples
Initialize the tag cloud with the
hidden-categoriesattribute specified:<oj-tag-cloud hidden-categories='["soda", "water"]'></oj-tag-cloud>Get or set the
hiddenCategoriesproperty after initialization:// Get one var value = myTagCloud.hiddenCategories[0]; // Get all var values = myTagCloud.hiddenCategories; // Set all (There is no permissible "set one" syntax.) myTagCloud.hiddenCategories=["soda", "water"]; -
highlight-match :string
-
The matching condition for the highlightedCategories option. By default, highlightMatch is 'all' and only items whose categories match all of the values specified in the highlightedCategories array will be highlighted. If highlightMatch is 'any', then items that match at least one of the highlightedCategories values will be highlighted.
- Default Value:
"all"
Supported Values:
Name Type "all"string "any"string Names
Item Name Property highlightMatchProperty change event highlightMatchChangedProperty change listener attribute (must be of type function) on-highlight-match-changedExamples
Initialize the tag cloud with the
highlight-matchattribute specified:<oj-tag-cloud highlight-match='all'></oj-tag-cloud>Get or set the
highlightMatchproperty after initialization:// getter var value = myTagCloud.highlightMatch; // setter myTagCloud.highlightMatch="all"; -
highlighted-categories :Array.<string>
-
An array of category strings used for category highlighting. Data items with a category in highlightedCategories will be highlighted.
- Default Value:
[]
- Supports writeback:
true
Names
Item Name Property highlightedCategoriesProperty change event highlightedCategoriesChangedProperty change listener attribute (must be of type function) on-highlighted-categories-changedExamples
Initialize the tag cloud with the
highlighted-categoriesattribute specified:<oj-tag-cloud highlighted-categories='["soda", "water"]'></oj-tag-cloud>Get or set the
highlightedCategoriesproperty after initialization:// Get one var value = myTagCloud.highlightedCategories[0]; // Get all var values = myTagCloud.highlightedCategories; // Set all (There is no permissible "set one" syntax.) myTagCloud.highlightedCategories=["soda", "water"]; -
hover-behavior :string
-
Defines the behavior applied when hovering over data items.
- Default Value:
"none"
Supported Values:
Name Type "dim"string "none"string Names
Item Name Property hoverBehaviorProperty change event hoverBehaviorChangedProperty change listener attribute (must be of type function) on-hover-behavior-changedExamples
Initialize the tag cloud with the
hover-behaviorattribute specified:<oj-tag-cloud hover-behavior='dim'></oj-tag-cloud>Get or set the
hoverBehaviorproperty after initialization:// getter var value = myTagCloud.hoverBehavior; // setter myTagCloud.hoverBehavior="dim"; -
items :(Array.<oj.ojTagCloud.Item>|Promise.<Array.<oj.ojTagCloud.Item>>|null)
-
An array of objects with the following properties that defines the data items for the tag cloud items. Also accepts a Promise or callback function for deferred data rendering. The function should return one of the following:
- Promise: A Promise that will resolve with an array of data items. No data will be rendered if the Promise is rejected.
- Array: An array of data items.
- Default Value:
null
Names
Item Name Property itemsProperty change event itemsChangedProperty change listener attribute (must be of type function) on-items-changedExamples
Initialize the tag cloud with the
itemsattribute specified:<oj-tag-cloud items='[{"id": "item1", "label": "the", "value": 20}, {"id": "item2", "label": "cat", "value": 17}, {"id": "item3", "label": "hat", "value": 13}]'></oj-tag-cloud> <oj-tag-cloud items='[[itemsPromise]]'></oj-tag-cloud>Get or set the
itemsproperty after initialization:// Get all (The items getter always returns a Promise so there is no "get one" syntax) var values = myTagCloud.items; // Set all (There is no permissible "set one" syntax.) myTagCloud.items=[{"id": "item1", "label": "the", "value": 20}, {"id": "item2", "label": "cat", "value": 17}, {"id": "item3", "label": "hat", "value": 13}]; -
layout :string
-
The layout to use for tag display.
- Default Value:
"rectangular"
Supported Values:
Name Type "cloud"string "rectangular"string Names
Item Name Property layoutProperty change event layoutChangedProperty change listener attribute (must be of type function) on-layout-changedExamples
Initialize the tag cloud with the
layoutattribute specified:<oj-tag-cloud layout='cloud'></oj-tag-cloud>Get or set the
layoutproperty after initialization:// getter var value = myTagCloud.layout; // setter myTagCloud.layout="cloud"; -
selection :Array.<any>
-
An array of id strings, used to define the selected data items.
- Default Value:
[]
- Supports writeback:
true
Names
Item Name Property selectionProperty change event selectionChangedProperty change listener attribute (must be of type function) on-selection-changedExamples
Initialize the tag cloud with the
selectionattribute specified:<oj-tag-cloud selection='["area1", "area2", "marker7"]'></oj-tag-cloud>Get or set the
selectionproperty after initialization:// Get one var value = myTagCloud.selection[0]; // Get all var values = myTagCloud.selection; // Set all (There is no permissible "set one" syntax.) myTagCloud.selection=["tag2", "tag3", "tag12"]; -
selection-mode :string
-
The type of selection behavior that is enabled on the tag cloud.
- Default Value:
"none"
Supported Values:
Name Type "multiple"string "none"string "single"string Names
Item Name Property selectionModeProperty change event selectionModeChangedProperty change listener attribute (must be of type function) on-selection-mode-changedExamples
Initialize the tag cloud with the
selection-modeattribute specified:<oj-tag-cloud selection-mode='multiple'></oj-tag-cloud>Get or set the
selectionModeproperty after initialization:// getter var value = myTagCloud.selectionMode; // setter myTagCloud.selectionMode="multiple"; -
style-defaults :Object
-
Component CSS classes should be used to set component wide styling. This API should be used only for styling a specific instance of the component. Properties specified on this object may be overridden by specifications on the data item. Some property default values come from the CSS and varies based on theme.
Names
Item Name Property styleDefaultsProperty change event styleDefaultsChangedProperty change listener attribute (must be of type function) on-style-defaults-changedExamples
Initialize the tag cloud with the
style-defaultsattribute specified:<oj-tag-cloud style-defaults.animation-duration='200'></oj-tag-cloud> <oj-tag-cloud style-defaults='{"animationDuration": 200, "svgStyle": {"fill": "url(someURL#filterId)"}}'></oj-tag-cloud>Get or set the
styleDefaultsproperty after initialization:// Get one var value = myTagCloud.styleDefaults.animationDuration; // Get all var values = myTagCloud.styleDefaults; // Set one, leaving the others intact. Always use the setProperty API for // subproperties rather than setting a subproperty directly. myTagCloud.setProperty('styleDefaults.svgStyle', {'fill': 'url(someURL#filterId)'}); // Set all. Must list every resource key, as those not listed are lost. myTagCloud.styleDefaults={'fill': 'url(someURL#filterId)'}; -
style-defaults.animation-duration :number
-
The duration of the animations in milliseconds. The default value comes from the CSS and varies based on theme.
Names
Item Name Property styleDefaults.animationDurationExample
See the styleDefaults attribute for usage examples. -
style-defaults.hover-behavior-delay :number
-
Specifies initial hover delay in ms for highlighting data items.
- Default Value:
200
Names
Item Name Property styleDefaults.hoverBehaviorDelayExample
See the styleDefaults attribute for usage examples. -
style-defaults.svg-style :Object
-
The CSS style object defining the style of the items. The default value comes from the CSS and varies based on theme.
- Default Value:
{}
Names
Item Name Property styleDefaults.svgStyleExample
See the styleDefaults attribute for usage examples. -
tooltip :Object
-
An object containing an optional callback function for tooltip customization.
Names
Item Name Property tooltipProperty change event tooltipChangedProperty change listener attribute (must be of type function) on-tooltip-changedExamples
Initialize the tag cloud with the
tooltipattribute specified:<oj-tag-cloud tooltip.renderer='[[tooltipFun]]'></oj-tag-cloud> <oj-tag-cloud tooltip='[[{"renderer": tooltipFun}]]'></oj-tag-cloud>Get or set the
tooltipproperty after initialization:// Get one var value = myTagCloud.tooltip.renderer; // Get all var values = myTagCloud.tooltip; // Set one, leaving the others intact. Always use the setProperty API for // subproperties rather than setting a subproperty directly. myTagCloud.setProperty('tooltip.renderer', tooltipFun); // Set all. Must list every resource key, as those not listed are lost. myTagCloud.tooltip={'renderer': tooltipFun}; -
tooltip.renderer :((context: oj.ojTagCloud.TooltipContext) => ({insert: Element|string}|{preventDefault: boolean}))
-
A callback function that returns a custom tooltip. The callback function will be called with a context object containing information about the item that was clicked.
- Default Value:
null
Names
Item Name Property tooltip.rendererExample
See the tooltip attribute for usage examples. -
touch-response :string
-
Data visualizations require a press and hold delay before triggering tooltips and rollover effects on mobile devices to avoid interfering with page panning, but these hold delays can make applications seem slower and less responsive. For a better user experience, the application can remove the touch and hold \delay when data visualizations are used within a non scrolling container or if there is sufficient space outside of the visualization for panning. If touchResponse is touchStart the element will instantly trigger the touch gesture and consume the page pan events. If touchResponse is auto, the element will behave like touchStart if it determines that it is not rendered within scrolling content and if element panning is not available for those elements that support the feature.
- Default Value:
"auto"
Supported Values:
Name Type "auto"string "touchStart"string Names
Item Name Property touchResponseProperty change event touchResponseChangedProperty change listener attribute (must be of type function) on-touch-response-changedExamples
Initialize the tag cloud with the
layoutattribute specified:<oj-tag-cloud touch-response='touchStart'></oj-tag-cloud>Get or set the
touchResponseproperty after initialization:// getter var value = myTagCloud.touchResponse; // setter myTagCloud.touchResponse="touchStart"; -
track-resize :string
-
Defines whether the element will automatically render in response to changes in size. If set to
off, then the application is responsible for callingrefreshto render the element at the new size.- Default Value:
"on"
Supported Values:
Name Type "off"string "on"string Names
Item Name Property trackResizeProperty change event trackResizeChangedProperty change listener attribute (must be of type function) on-track-resize-changedExamples
Initialize the data visualization element with the
track-resizeattribute specified:<oj-some-dvt track-resize='off'></oj-some-dvt>Get or set the
trackResizeproperty after initialization:// getter var value = myComponent.trackResize; // setter myComponent.trackResize="off"; -
translations :Object|null
-
A collection of translated resources from the translation bundle, or
nullif this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.If the component does not contain any translatable resource, the default value of this attribute will be
null. If not, an object containing all resources relevant to the component.If this component has translations, their documentation immediately follows this doc entry.
Names
Item Name Property translationsProperty change event translationsChangedProperty change listener attribute (must be of type function) on-translations-changedExamples
Initialize the component, overriding some translated resources and leaving the others intact:
<!-- Using dot notation --> <oj-some-element translations.some-key='some value' translations.some-other-key='some other value'></oj-some-element> <!-- Using JSON notation --> <oj-some-element translations='{"someKey":"some value", "someOtherKey":"some other value"}'></oj-some-element>Get or set the
translationsproperty after initialization:// Get one var value = myComponent.translations.someKey; // Set one, leaving the others intact. Always use the setProperty API for // subproperties rather than setting a subproperty directly. myComponent.setProperty('translations.someKey', 'some value'); // Get all var values = myComponent.translations; // Set all. Must list every resource key, as those not listed are lost. myComponent.translations = { someKey: 'some value', someOtherKey: 'some other value' }; -
(nullable) translations.component-name :string
-
Used to describe the data visualization type for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Tag Cloud"
Names
Item Name Property translations.componentName -
(nullable) translations.label-and-value :string
-
Used to display a label and its value.
See the translations attribute for usage examples.
- Default Value:
"{0}: {1}"
Names
Item Name Property translations.labelAndValue -
(nullable) translations.label-clear-selection :string
-
Text shown for clearing multiple selection on touch devices.
See the translations attribute for usage examples.
- Default Value:
"Clear Selection"
Names
Item Name Property translations.labelClearSelection -
(nullable) translations.label-count-with-total :string
-
Used to display a count out of a total.
See the translations attribute for usage examples.
- Default Value:
"{0} of {1}"
Names
Item Name Property translations.labelCountWithTotal -
(nullable) translations.label-data-visualization :string
-
Label for data visualizations used for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Data Visualization"
Names
Item Name Property translations.labelDataVisualization -
(nullable) translations.label-invalid-data :string
-
Text shown when the component receives invalid data.
See the translations attribute for usage examples.
- Default Value:
"Invalid data"
Names
Item Name Property translations.labelInvalidData -
(nullable) translations.label-no-data :string
-
Text shown when the component receives no data.
See the translations attribute for usage examples.
- Default Value:
"No data to display"
Names
Item Name Property translations.labelNoData -
(nullable) translations.state-collapsed :string
-
Used to describe the collapsed state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Collapsed"
Names
Item Name Property translations.stateCollapsed -
(nullable) translations.state-drillable :string
-
Used to describe a drillable object for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Drillable"
Names
Item Name Property translations.stateDrillable -
(nullable) translations.state-expanded :string
-
Used to describe the expanded state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Expanded"
Names
Item Name Property translations.stateExpanded -
(nullable) translations.state-hidden :string
-
Used to describe the hidden state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Hidden"
Names
Item Name Property translations.stateHidden -
(nullable) translations.state-isolated :string
-
Used to describe the isolated state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Isolated"
Names
Item Name Property translations.stateIsolated -
(nullable) translations.state-maximized :string
-
Used to describe the maximized state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Maximized"
Names
Item Name Property translations.stateMaximized -
(nullable) translations.state-minimized :string
-
Used to describe the minimized state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Minimized"
Names
Item Name Property translations.stateMinimized -
(nullable) translations.state-selected :string
-
Used to describe the selected state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Selected"
Names
Item Name Property translations.stateSelected -
(nullable) translations.state-unselected :string
-
Used to describe the unselected state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Unselected"
Names
Item Name Property translations.stateUnselected -
(nullable) translations.state-visible :string
-
Used to describe the visible state for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Visible"
Names
Item Name Property translations.stateVisible
Context Objects
Each context object contains, at minimum, a subId property,
whose value is a string that identifies a particular DOM node in this element. It can have additional properties to further specify the desired node. See getContextByNode for more details.
Properties:
| Name | Type | Description |
|---|---|---|
subId |
string | Sub-id string to identify a particular dom node. |
Following are the valid subIds:
-
oj-tagcloud-item
-
Context for tag cloud items at a specified index.
Properties:
Name Type indexnumber
Methods
-
getContextByNode(node) → {(oj.ojTagCloud.NodeContext|null)}
-
Returns an object with context for the given child DOM node. This will always contain the subid for the node, defined as the 'subId' property on the context object. Additional component specific information may also be included. For more details on returned objects, see context objects.
Parameters:
Name Type Argument Description nodeElement <not nullable>
The child DOM node Returns:
The context for the DOM node, ornullwhen none is found.- Type
- (oj.ojTagCloud.NodeContext|null)
Example
// Returns {'subId': 'oj-some-sub-id', 'componentSpecificProperty': someValue, ...} var context = myComponent.getContextByNode(nodeInsideElement); -
getItem(index) → {(oj.ojTagCloud.ItemContext|null)}
-
Returns an object with the following properties for automation testing verification of the item at the specified index.
Parameters:
Name Type Description indexnumber The index. Returns:
An object containing data for the node at the given index, or null if none exists.- Type
- (oj.ojTagCloud.ItemContext|null)
-
getItemCount() → {number}
-
Returns the number of items in the tag cloud data.
Returns:
The number of data items- Type
- number
-
getProperty(property) → {any}
-
Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. - Since:
- 4.0.0
Returns:
- Type
- any
Example
Get a single subproperty of a complex property:
var subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
refresh() → {void}
-
Refreshes the component.
Returns:
- Type
- void
-
setProperties(properties) → {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. - Since:
- 4.0.0
Returns:
- Type
- void
Example
Set a batch of properties:
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"}); -
setProperty(property, value) → {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. - Since:
- 4.0.0
Returns:
- Type
- void
Example
Set a single subproperty of a complex property:
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");
Type Definitions
-
Item
-
Properties:
Name Type Argument Description categoriesArray.<string> <optional>
An array of category strings corresponding to the tag cloud items. This allows highlighting and filtering of items. colorstring <optional>
The color of the text. Will be overridden by any color defined in the style option. The default value comes from the CSS and varies based on theme. idany <optional>
The item id should be set by the application if the DataProvider is not being used. The row key will be used as id in the DataProvider case. labelstring The text of the item. shortDescstring <optional>
The description of the item. This is used for customizing the tooltip text. svgStyleObject <optional>
The CSS style object defining the style of the item text. svgClassNamestring <optional>
The CSS style class defining the style of the item text. urlstring <optional>
The url this item references. valuenumber The value of this item which will be used to scale its font-size within the tag cloud. -
ItemContext
-
Properties:
Name Type Description colorstring The color of the item at the given index. labelstring The data label of the item at the given index. selectedboolean True if the item at the given index is currently selected and false otherwise. tooltipstring The tooltip of the item at the given index. valuenumber The value of the item at the given index. -
NodeContext
-
Properties:
Name Type Description subIdstring The subId string identify the particular DOM node. indexnumber The zero based index of the tag cloud item. -
TooltipContext
-
Properties:
Name Type Description colorstring The color of the hovered item. componentElementElement The tag cloud element. idany The id of the hovered item. labelstring The data label of the hovered item. parentElementElement The tooltip element. The function can directly modify or append content to this element. valuenumber The value of the hovered item.