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>
Attributes
-
drilling :string
-
Whether drilling is enabled on all legend items. Drillable objects will show a pointer cursor on hover and fire
ojDrillevent on click. To enable or disable drilling on individual legend item, use the drilling attribute in each legend item.- Default Value:
"off"
Supported Values:
Name Type "off"string "on"string Names
Item Name Property drillingProperty change event drillingChangedProperty change listener attribute (must be of type function) on-drilling-changedExamples
Initialize the Legend with the
drillingattribute specified:<oj-legend drilling="on"></oj-legend>Get or set the
drillingproperty after initialization:// getter var drillingValue = myLegend.drilling; // setter myLegend.drilling = 'on'; -
halign :string
-
Defines the horizontal alignment of the legend contents.
- Default Value:
"start"
Supported Values:
Name Type "center"string "end"string "start"string Names
Item Name Property halignProperty change event halignChangedProperty change listener attribute (must be of type function) on-halign-changedExamples
Initialize the Legend with the
halignattribute specified:<oj-legend halign="center"></oj-legend>Get or set the
halignproperty after initialization:// getter var halignValue = myLegend.halign; // setter myLegend.halign = "center"; -
hidden-categories :Array.<string>
-
An array of categories that will be hidden.
- 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 Legend with the
hidden-categoriesattribute specified:<oj-legend hidden-categories='["Apples", "Bananas"]'></oj-legend>Get or set the
hiddenCategoriesproperty after initialization:// Get one var value = myLegend.hiddenCategories[0]; // Get all var hiddenCategoriesValue = myLegend.hiddenCategories; // setter myLegend.hiddenCategories = ["Apples", "Bananas"]; -
hide-and-show-behavior :string
-
Defines whether the legend can be used to initiate hide and show behavior on referenced data items.
- Default Value:
"off"
Supported Values:
Name Type "off"string "on"string Names
Item Name Property hideAndShowBehaviorProperty change event hideAndShowBehaviorChangedProperty change listener attribute (must be of type function) on-hide-and-show-behavior-changedExamples
Initialize the Legend with the
hide-and-show-behaviorattribute specified:<oj-legend hide-and-show-behavior="on"></oj-legend>Get or set the
hideAndShowBehaviorproperty after initialization:// getter var hideAndShowValue = myLegend.hideAndShowBehavior; // setter myLegend.hideAndShowBehavior = 'on'; -
highlighted-categories :Array.<string>
-
An array of categories that 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 Legend with the
highlighted-categoriesattribute specified:<oj-legend highlighted-categories='["Bananas", "Apples"]'></oj-legend>Get or set the
highlightedCategoriesproperty after initialization:// Get one var value = myLegend.highlightedCategories[0]; // getter var highlightedCategoriesValue = myLegend.highlightedCategories; // setter myLegend.highlightedCategories = ["Bananas", "Apples"]; -
hover-behavior :string
-
Defines the behavior applied when hovering over a legend item.
- 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 Legend with the
hover-behaviorattribute specified:<oj-legend hover-behavior="dim"></oj-legend>Get or set the
hoverBehaviorproperty after initialization:// getter var hoverBehaviorValue = myLegend.hoverBehavior; // setter myLegend.hoverBehavior = 'dim'; -
hover-behavior-delay :number
-
Specifies initial hover delay in ms for highlighting items in legend.
- Default Value:
200
Names
Item Name Property hoverBehaviorDelayProperty change event hoverBehaviorDelayChangedProperty change listener attribute (must be of type function) on-hover-behavior-delay-changedExamples
Initialize the Legend with the
hover-behavior-delayattribute specified:<oj-legend hover-behavior-delay="150"></oj-legend>Get or set the
hoverBehaviorDelayproperty after initialization:// getter var delayValue = myLegend.hoverBehaviorDelay; // setter myLegend.hoverBehaviorDelay = 150; -
orientation :string
-
Defines the orientation of the legend, which determines the direction in which the legend items are laid out.
- Default Value:
"vertical"
Supported Values:
Name Type "horizontal"string "vertical"string Names
Item Name Property orientationProperty change event orientationChangedProperty change listener attribute (must be of type function) on-orientation-changedExamples
Initialize the Legend with the
orientationattribute specified:<oj-legend orientation="horizontal"></oj-legend>Get or set the
orientationproperty after initialization:// getter var orientationValue = myLegend.orientation; // setter myLegend.orientation = "horizontal"; -
scrolling :string
-
Defines whether scrolling is enabled for the legend.
- Default Value:
"asNeeded"
Supported Values:
Name Type "asNeeded"string "off"string Names
Item Name Property scrollingProperty change event scrollingChangedProperty change listener attribute (must be of type function) on-scrolling-changedExamples
Initialize the Legend with the
scrollingattribute specified:<oj-legend scrolling="off"></oj-legend>Get or set the
scrollingproperty after initialization:// getter var scrollingValue = myLegend.scrolling; // setter myLegend.scrolling = 'off'; -
sections :Array.<Object>|null
-
An array of objects with the following properties defining the legend sections.
- Default Value:
null
Names
Item Name Property sectionsProperty change event sectionsChangedProperty change listener attribute (must be of type function) on-sections-changedExamples
Initialize the legend with the
sectionsattribute specified:<oj-legend sections='[{"title": "Brand", "expanded": "on", "collapsible": "on", items: [{"color": "red", "text": "Coke", "id": "Coke"}, {"color": "blue", "text": "Pepsi", "id": "Pepsi"}, {"color": "yellow", "text": "Snapple", "id": "Snapple"}, {"color": "brown", "text": "Nestle", "id": "Nestle"}]}]'> </oj-legend> <oj-legend sections='[[sectionsPromise]]'></oj-legend>Get or set the
sectionsproperty after initialization:// Get one var value = myLegend.sections[0]; // Get all (The items getter always returns a Promise so there is no "get one" syntax) var values = myLegend.sections; // Set all (There is no permissible "set one" syntax.) myLegend.sections=[{title: "Brand", expanded: "on", collapsible: "on", items: [{color: "red", text: "Coke", id: "Coke"}, {color: "blue", text: "Pepsi", id: "Pepsi"}, {color: "yellow", text: "Snapple", id: "Snapple"}, {color: "brown", text: "Nestle", id: "Nestle"}]}]; -
sections[].collapsible :string
-
Whether the section is collapsible. Only applies if the legend orientation is vertical.
- Default Value:
"off"
Supported Values:
Name Type "off"string "on"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].expanded :string
-
Whether the section is initially expanded. Only applies if the section is collapsible.
- Default Value:
"on"
Supported Values:
Name Type "off"string "on"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items :Array.<Object>|Promise
-
An array of objects with the following properties defining the legend items. Also accepts a Promise for deferred data rendering. No data will be rendered if the Promise is rejected.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].borderColor :string
-
The border color of the marker. Only applies if symbolType is "marker" or "lineWithMarker".
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].categories :Array.<string>
-
An array of categories for the legend item. Legend items currently only support a single category. If no category is specified, this defaults to the id or text of the legend item.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].categoryVisibility :string
-
Defines whether the legend item corresponds to visible data items. A hollow symbol is shown if the value is "hidden".
- Default Value:
"visible"
Supported Values:
Name Type "hidden"string "visible"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].color :string
-
The color of the legend symbol (line or marker). When symbolType is "lineWithMarker", this attribute defines the line color and the markerColor attribute defines the marker color.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].drilling :string
-
Whether drilling is enabled on the legend item. Drillable objects will show a pointer cursor on hover and fire
ojDrillevent on click. To enable drilling for all legend items at once, use the drilling attribute in the top level.- Default Value:
"inherit"
Supported Values:
Name Type "inherit"string "off"string "on"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].id :string
-
The id of the legend item, which is provided as part of the context for events fired by the legend. If not specified, the id defaults to the text of the legend item.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].lineStyle :string
-
The line style. Only applies when the symbolType is "line" or "lineWithMarker".
- Default Value:
"solid"
Supported Values:
Name Type "dashed"string "dotted"string "solid"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].lineWidth :number
-
The line width in pixels. Only applies when the symbolType is "line" or "lineWithMarker".
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].markerColor :string
-
The color of the marker, if different than the line color. Only applies if the symbolType is "lineWithMarker".
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].markerShape :string
-
The shape of the marker. Only applies if symbolType is "marker" or "lineWithMarker". Can take the name of a built-in shape or the svg path commands for a custom shape. Does not apply if a custom image is specified.
- Default Value:
"square"
Supported Values:
Name Type "circle"string "diamond"string "ellipse"string "human"string "plus"string "rectangle"string "square"string "star"string "triangleDown"string "triangleUp"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].markerSvgClassName :string
-
The CSS style class to apply to the marker. The style class and inline style will override any other styling specified through the options. For tooltips and hover interactivity, it's recommended to also pass a representative color to the markerColor attribute.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].markerSvgStyle :Object
-
The inline style to apply to the marker. The style class and inline style will override any other styling specified through the options. For tooltips and hover interactivity, it's recommended to also pass a representative color to the markerColor attribute.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].pattern :string
-
The pattern used to fill the marker. Only applies if symbolType is "marker" or "lineWithMarker".
- Default Value:
"none"
Supported Values:
Name Type "largeChecker"string "largeCrosshatch"string "largeDiagonalLeft"string "largeDiagonalRight"string "largeDiamond"string "largeTriangle"string "none"string "smallChecker"string "smallCrosshatch"string "smallDiagonalLeft"string "smallDiagonalRight"string "smallDiamond"string "smallTriangle"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].shortDesc :string
-
The description of this legend item. This is used for accessibility and for customizing the tooltip text.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].source :string
-
The URI of the image of the legend symbol.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].svgClassName :string
-
The CSS style class to apply to the legend item. The style class and inline style will override any other styling specified through the options. For tooltips and hover interactivity, it's recommended to also pass a representative color to the color attribute.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].svgStyle :Object
-
The inline style to apply to the legend item. The style class and inline style will override any other styling specified through the options. For tooltips and hover interactivity, it's recommended to also pass a representative color to the color attribute.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].symbolType :string
-
The type of legend symbol to display.
- Default Value:
"marker"
Supported Values:
Name Type "image"string "line"string "lineWithMarker"string "marker"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].items[].text :string
-
The legend item text.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].sections :Array.<Object>
-
An array of nested legend sections.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].title :string
-
The title of the legend section.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].titleHalign :string
-
The horizontal alignment of the section title. If the section is collapsible or nested, only start alignment is supported.
- Default Value:
"start"
Supported Values:
Name Type "center"string "end"string "start"string Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
sections[].titleStyle :Object
-
The CSS style object defining the style of the section title.
- Default Value:
null
Note: This property is a subproperty of an array-valued property. Such properties cannot be set individually either at init time via HTML attribute syntax or at runtime via JavaScript. Instead, the outermost array-valued attribute, and its ancestor attributes, can be set at init time or runtime. -
symbol-height :number
-
The height of the legend symbol (line or marker) in pixels. If the value is 0, it will take the same value as symbolWidth. If both symbolWidth and symbolHeight are 0, then it will use a default value that may vary based on theme.
- Default Value:
0
Names
Item Name Property symbolHeightProperty change event symbolHeightChangedProperty change listener attribute (must be of type function) on-symbol-height-changedExamples
Initialize the Legend with the
symbol-heightattribute specified:<oj-legend symbol-height="20"></oj-legend>Get or set the
symbolHeightproperty after initialization:// getter var symbolHeightValue = myLegend.symbolHeight; // setter myLegend.symbolHeight = 20; -
symbol-width :number
-
The width of the legend symbol (line or marker) in pixels. If the value is 0, it will take the same value as symbolWidth. If both symbolWidth and symbolHeight are 0, then it will use a default value that may vary based on theme.
- Default Value:
0
Names
Item Name Property symbolWidthProperty change event symbolWidthChangedProperty change listener attribute (must be of type function) on-symbol-width-changedExamples
Initialize the Legend with the
symbol-widthattribute specified:<oj-legend symbol-width="15"></oj-legend>Get or set the
symbolWidthproperty after initialization:// getter var symbolWidthValue = myLegend.symbolWidth; // setter myLegend.symbolWidth = 15; -
text-style :Object
-
The CSS style object defining the style of the legend item text. The default value comes from the CSS and varies based on theme.
Names
Item Name Property textStyleProperty change event textStyleChangedProperty change listener attribute (must be of type function) on-text-style-changedExamples
Initialize the Legend with the
text-styleattribute specified:<oj-legend text-style='{"fontSize":"12px"}'></oj-legend>Get or set the
textStyleproperty after initialization:// getter var textStyleValue = myLegend.textStyle; // setter myLegend.textStyle = {"fontSize" : "12px"}; -
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:
"Legend"
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 -
valign :string
-
Defines the vertical alignment of the legend contents.
- Default Value:
"top"
Supported Values:
Name Type "bottom"string "middle"string "top"string Names
Item Name Property valignProperty change event valignChangedProperty change listener attribute (must be of type function) on-valign-changedExamples
Initialize the Legend with the
valignattribute specified:<oj-legend valign="middle"></oj-legend>Get or set the
valignproperty after initialization:// getter var valignValue = myLegend.valign; // setter myLegend.valign = "middle";
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-legend-item
-
Context for legend items indexed by their section and item indices.
Properties:
Name Type Description sectionIndexPathArray The array of numerical indices for the section. itemIndexnumber The index of the item within the specified section.
Events
-
ojDrill
-
Triggered during a drill gesture (single click on the legend item).
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description idstring the id of the drilled object Examples
Specify an
ojDrilllistener via the DOM attribute:<oj-legend on-oj-drill='[[listener]]'></oj-legend>Specify an
ojDrilllistener via the JavaScript property:myLegend.onOjDrill = listener;Add an
ojDrilllistener via theaddEventListenerAPI:myLegend.addEventListener('ojDrill', listener);
Methods
-
getContextByNode(node) → {Object|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
- Object | null
Example
// Returns {'subId': 'oj-some-sub-id', 'componentSpecificProperty': someValue, ...} var context = myComponent.getContextByNode(nodeInsideElement); -
getItem(subIdPath) → {Object|null}
-
Returns an object with the following properties for automation testing verification of the legend item with the specified subid path.
Parameters:
Name Type Description subIdPathArray The array of indices in the subId for the desired legend item. Properties:
Name Type textstring Returns:
An object containing properties for the legend item at the given subIdPath, or null if none exists.- Type
- Object | null
-
getPreferredSize(width, height) → {Object}
-
Returns the preferred size of the legend, given the available width and height. A re-render must be triggered by calling
refreshafter invoking this function.Parameters:
Name Type Description widthNumber The available width. heightNumber The available height. Returns:
An object containing the preferred width and height.- Type
- Object
-
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'); -
getSection(subIdPath) → {Object|null}
-
Returns an object with the following properties for automation testing verification of the legend section with the specified subid path.
Parameters:
Name Type Description subIdPathArray The array of indices in the subId for the desired legend section. Properties:
Name Type Description titlestring getSectionfunction(number) Returns the section with the specified index. Properties
Name Type titlestring Returns:
An object containing properties for the legend section at the given subIdPath, or null if none exists.- Type
- Object | null
-
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");