Usage
Signature:
interface PictoChartElement<K, D extends ojPictoChart.Item<K>|any>
Generic Parameters
Parameter Description K Type of key of the dataprovider D Type of data from the dataprovider
Typescript Import Format
//To typecheck the element APIs, import as below.
import { PictoChartElement } from "ojs/ojpictochart";
//For the transpiled javascript to load the element's module, import as below
import "ojs/ojpictochart";
For additional information visit:
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 components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.
-
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 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.
-
itemTemplate
-
The
itemTemplateslot is used to specify the template for creating each item of the picto chart when a DataProvider has been specified with the data attribute. The slot content must be a single <template> element.When the template is executed for each item, it will have access to the picto chart's binding context and the following properties:
- $current - an object that contains information for the current item. (See oj.ojPictoChart.ItemTemplateContext or the table below for a list of properties available on $current)
- 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-picto-chart-item> element. See the oj-picto-chart-item doc for more details.
- Deprecated:
-
Since Description 16.0.0The componentElement property is deprecated. This shouldn't be needed, as the component template with access to this context is unique to the component.
Properties of $current:
Name Type Description componentElementElement The <oj-picto-chart> 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. -
tooltipTemplate
-
The
tooltipTemplateslot is used to specify custom tooltip content. The slot content must be a single <template> element. This slot takes precedence over the tooltip.renderer property if specified.When the template is executed, the component's binding context is extended with the following properties:
- $current - an object that contains information for the current item. (See oj.ojPictoChart.TooltipContext or the table below for a list of properties available on $current)
- Deprecated:
-
Since Description 16.0.0The componentElement property is deprecated. This shouldn't be needed, as the component template with access to this context is unique to the component.
Properties of $current:
Name Type Description colorstring The color of the hovered item. componentElementElement The picto chart HTML element. countnumber The count of the hovered item. idK The id of the hovered item. namestring The name of the hovered item. parentElementElement The tooltip element. The function can directly modify or append content to this element.
Attributes
-
(nullable) 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 animationDurationProperty change event animationDurationChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-animation-duration-changed -
animation-on-data-change :"auto"|"none"
-
The animation when the data changes.
- Default Value:
"none"
Supported Values:
Value autononeNames
Item Name Property animationOnDataChangeProperty change event animationOnDataChangeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-animation-on-data-change-changed -
animation-on-display :"auto"|"popIn"|"alphaFade"|"zoom"|"none"
-
The animation that is shown on initial display.
- Default Value:
"none"
Supported Values:
Value alphaFadeautononepopInzoomNames
Item Name Property animationOnDisplayProperty change event animationOnDisplayChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-animation-on-display-changed -
as :string
-
An alias for the $current context variable when referenced inside itemTemplate when using a DataProvider.
- Deprecated:
-
Since Description 6.2.0Set the alias directly on the template element using the data-oj-as attribute instead.
- Default Value:
""
Names
Item Name Property asProperty change event asChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-as-changed -
column-count :number|null
-
The number of columns that the picto chart has. The number of columns will be automatically computed if not specified.
- Default Value:
null
Names
Item Name Property columnCountProperty change event columnCountChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-column-count-changed -
column-width :number|null
-
The width of a column in pixels. The width of columns will be automatically computed if not specified. Setting this property in a fixed layout (when the element width and height are defined) may cause items to be truncated.
- Default Value:
null
Names
Item Name Property columnWidthProperty change event columnWidthChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-column-width-changed -
data :(DataProvider.<K, D>|null)
-
The DataProvider for the picto chart. It should provide rows where each row corresponds to a single picto chart item. The DataProvider can either have an arbitrary data shape, in which case an
element must be specified in the itemTemplate slot or it can have oj.ojPictoChart.Item as its data shape, in which case no template is required. - Default Value:
null
Names
Item Name Property dataProperty change event dataChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed -
drilling :"on"|"off"
-
Whether drilling is enabled. Drillable items will show a pointer cursor on hover and fire an
ojDrillevent on click (double click if selection is enabled). To enable or disable drilling on individual items, use the drilling attribute in each item.- Default Value:
"off"
Supported Values:
Value offonNames
Item Name Property drillingProperty change event drillingChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-drilling-changed -
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, see Events and Listeners for additional information.) on-hidden-categories-changed -
highlight-match :"any"|"all"
-
The matching condition for the highlightedCategories property. 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:
Value allanyNames
Item Name Property highlightMatchProperty change event highlightMatchChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-highlight-match-changed -
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, see Events and Listeners for additional information.) on-highlighted-categories-changed -
hover-behavior :"dim"|"none"
-
The behavior applied when hovering over data items.
- Default Value:
"none"
Supported Values:
Value dimnoneNames
Item Name Property hoverBehaviorProperty change event hoverBehaviorChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-hover-behavior-changed -
hover-behavior-delay :number
-
Specifies initial hover delay in milliseconds for highlighting data items.
- Default Value:
200
Names
Item Name Property hoverBehaviorDelayProperty change event hoverBehaviorDelayChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-hover-behavior-delay-changed -
items :(Array.<oj.ojPictoChart.Item.<K>>|Promise.<Array.<oj.ojPictoChart.Item>>|null)
-
An array of objects with the following properties that defines the pictoChart items.
Type details
Setter Type (Array.<oj.ojPictoChart.Item.<K>>|Promise.<Array.<oj.ojPictoChart.Item>>|null) Getter Type Promise<Array<ojPictoChart.Item<K>>|null - Default Value:
null
Names
Item Name Property itemsProperty change event itemsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-items-changed -
layout :"vertical"|"horizontal"
-
The direction in which the items are laid out.
- Default Value:
"horizontal"
Supported Values:
Value horizontalverticalNames
Item Name Property layoutProperty change event layoutChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-layout-changed -
layout-origin :"topEnd"|"bottomStart"|"bottomEnd"|"topStart"
-
Defines where the first item is rendered. The subsequent items follow the first item according to the layout.
- Default Value:
"topStart"
Supported Values:
Value bottomEndbottomStarttopEndtopStartNames
Item Name Property layoutOriginProperty change event layoutOriginChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-layout-origin-changed -
row-count :number|null
-
The number of rows that the picto chart has. The number of rows will be automatically computed if not specified.
- Default Value:
null
Names
Item Name Property rowCountProperty change event rowCountChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-row-count-changed -
row-height :number|null
-
The height of a row in pixels. The height of rows will be automatically computed if not specified. Setting this property in a fixed layout (when the element width and height are defined) may cause items to be truncated.
- Default Value:
null
Names
Item Name Property rowHeightProperty change event rowHeightChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-row-height-changed -
selection :Array<K>
-
An array of id strings, used to define the selected objects.
- Default Value:
[]
- Supports writeback:
true
Names
Item Name Property selectionProperty change event selectionChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-changed -
selection-mode :"none"|"single"|"multiple"
-
The type of selection behavior that is enabled on the picto chart. This attribute controls the number of selections that can be made via selection gestures at any given time.
If
singleormultipleis specified, selection gestures will be enabled, and the picto chart's selection styling will be applied to all items specified by the selection attribute. Ifnoneis specified, selection gestures will be disabled, and the picto chart's selection styling will not be applied to any items specified by the selection attribute.Changing the value of this attribute will not affect the value of the selection attribute.
- Default Value:
"none"
Supported Values:
Value Description multipleMultiple items can be selected at the same time. noneSelection is disabled. singleOnly a single item can be selected at a time. Names
Item Name Property selectionModeProperty change event selectionModeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-mode-changed -
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, see Events and Listeners for additional information.) on-tooltip-changed -
tooltip.renderer :((context: ojPictoChart.TooltipRendererContext<K>) => ({insert: Element|string}|{preventDefault: boolean}))|null
-
A function that returns a custom tooltip. The function takes a TooltipContext argument, provided by the picto chart. The function should return an Object that contains only one of the two properties:
- insert: HTMLElement | string - An HTML element, which will be appended to the tooltip, or a tooltip string.
- preventDefault:
true- Indicates that the tooltip should not be displayed. It is not necessary to return {preventDefault:false} to display tooltip, since this is a default behavior.
- Default Value:
null
Names
Item Name Property tooltip.renderer -
track-resize :"on"|"off"
-
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:
Value offonNames
Item Name Property trackResizeProperty change event trackResizeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-track-resize-changed -
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, see Events and Listeners for additional information.) on-translations-changed -
(nullable) translations.accessible-contains-controls :string
-
Used to describe a container that contains controls.
See the translations attribute for usage examples.
- Since:
- 13.0.0
Names
Item Name Property translations.accessibleContainsControls -
(nullable) translations.component-name :string
-
Used to describe the data visualization type for accessibility.
See the translations attribute for usage examples.
- Default Value:
"Picture Chart"
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-pictochart-item
-
Context for tag cloud items at a specified index.
Properties:
Name Type indexnumber
Events
-
ojDrill
-
Triggered during a drill gesture (double click if selection is enabled, single click otherwise).
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description idany the id of the drilled object
Methods
-
getContextByNode(node) : {(oj.ojPictoChart.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, or
nullwhen none is found.- Type
- (oj.ojPictoChart.NodeContext|null)
-
getItem(index) : {(oj.ojPictoChart.ItemContext.<K>|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. Deprecated:
Since Description 7.0.0The use of this function is no longer recommended. Returns:
An object containing data for the item at the given index, or null if none exists.
- Type
- (oj.ojPictoChart.ItemContext.<K>|null)
-
getItemCount : {number}
-
Returns the number of items in the pictoChart data.
Deprecated:
Since Description 7.0.0The use of this function is no longer recommended. Returns:
The number of data items
- Type
- number
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
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:
let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
refresh : {void}
-
Refreshes the component.
Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
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 subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
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<K>
-
Properties:
Name Type Argument Default Description borderColorstring <optional>
The border color of the item. Does not apply if custom image is specified. borderWidthnumber <optional>
The border width of the item in pixels. Does not apply if custom image is specified. categoriesArray.<string> <optional>
An array of category strings corresponding to this item. If not specified, defaults to the item id or name. This enables highlighting and filtering of individual data items through interactions with other visualization elements. colorstring <optional>
The color of the item. Does not apply if custom image is specified. columnSpannumber <optional>
The number of columns each shape (or custom image) spans. Used for creating a pictoChart with mixed item sizes. countnumber <optional>
Specifies the number of times that the shape (or custom image) is drawn. Fractional counts (such as 4.5) are supported; however, fractions other than the multiples of 0.5 should be avoided because the fractional rendering ignores the gaps between shapes and the irregularity of the shapes. drilling"inherit" | "off" | "on" <optional>
"inherit" Whether drilling is enabled for the item. Drillable items will show a pointer cursor on hover and fire an ojDrillevent on click (double click if selection is enabled). To enable drilling for all items at once, use the drilling attribute in the top level.idK <optional>
The item id. The item id should be set by the application if the DataProvider is not being used. namestring <optional>
The name of the item. Used for default tooltip and accessibility. rowSpannumber <optional>
The number of rows each shape (or custom image) spans. Used for creating a pictoChart with mixed item sizes. shape"ellipse" | "square" | "circle" | "diamond" | "triangleUp" | "triangleDown" | "star" | "plus" | "human" | "none" | "rectangle" | string <optional>
"rectangle" The shape of the item. Can take the name of a built-in shape or the SVG path commands for a custom shape. "None" will make the item transparent and can be used to create gaps. Does not apply if custom image is specified. shortDesc?(string | ((context: ojPictoChart.ItemShortDescContext<K>) => string)) <optional>
Short description string for accessibility users. sourcestring <optional>
The URI of the custom image. If specified, it takes precedence over shape. sourceHoverstring <optional>
The optional URI for the hover state. If not specified, the source image will be used. sourceHoverSelectedstring <optional>
The optional URI for the hover selected state. If not specified, the source image will be used. sourceSelectedstring <optional>
The optional URI for the selected state. If not specified, the source image will be used. svgClassNamestring <optional>
The CSS style class to apply to the item. The style class and inline style will override any other styling specified with other properties. For tooltip interactivity, it's recommended to also pass a representative color to the item color attribute. Does not apply if custom image is specified. svgStylePartial<CSSStyleDeclaration> <optional>
The inline style to apply to the item. The style class and inline style will override any other styling specified with other properties. For tooltip interactivity, it's recommended to also pass a representative color to the item color attribute. Does not apply if custom image is specified. Only SVG CSS style properties are supported. -
ItemContext<K>
-
Properties:
Name Type colorstring countnumber idK namestring selectedboolean tooltipstring -
ItemShortDescContext<K>
-
Properties:
Name Type Description countnumber The count of the hovered item. idK The id of the hovered item. namestring The name of the hovered item. -
ItemTemplateContext
-
- Deprecated:
-
Since Description 16.0.0The componentElement property is deprecated. This shouldn't be needed, as the component template with access to this context is unique to the component.
Properties:
Name Type Description componentElementElement The <oj-picto-chart> 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. -
NodeContext
-
Properties:
Name Type Description indexnumber The zero based index of the picto chart item. subIdstring The subId string identify the particular DOM node. -
TooltipContext<K>
-
- Deprecated:
-
Since Description 16.0.0The componentElement property is deprecated. This shouldn't be needed, as the component template with access to this context is unique to the component.
Properties:
Name Type Description colorstring The color of the hovered item. componentElementElement The picto chart HTML element. countnumber The count of the hovered item. idK The id of the hovered item. namestring The name of the hovered item. parentElementElement The tooltip element. The function can directly modify or append content to this element. -
TooltipRendererContext<K>
-
Properties:
Name Type Description colorstring The color of the hovered item. componentElementElement The picto chart HTML element. countnumber The count of the hovered item. idK The id of the hovered item. namestring The name of the hovered item. parentElementElement The tooltip element. The function can directly modify or append content to this element.