API / geotoolkit / controls / shapes / Legend / Legend
This class defines a legend container in which legends items are laid out using specified layout. Items can be located in the legend vertically using VerticalPriorityLayout or horizontally using HorizontalPriorityLayout or in any location inside the legend with other layout or manually. The legend has an anchor position in the parent coordinates and width and height of the legend in model or device coordinates. This position can be specified with setAnchor method and size with setSize method. In addition it is possible to use automatic calculation of the legend size, which is supported for device size legend only. Legends can be customized using .setOptions().
Example
// Example of creating a legend with automatic size calculation in the device coordinates
import {Collection} from '@int/geotoolkit/util/Collection';
import {SymbolLegendItem} from '@int/geotoolkit/controls/shapes/SymbolLegendItem';
import {HorizontalLinePainter} from '@int/geotoolkit/scene/shapes/painters/HorizontalLinePainter';
import {Legend} from '@int/geotoolkit/controls/shapes/Legend';
import {AnchorType} from '@int/geotoolkit/util/AnchorType';
import {Point} from '@int/geotoolkit/util/Point';
import {VerticalPriorityLayout} from '@int/geotoolkit/layout/VerticalPriorityLayout';
const dataCollection = new Collection();
dataCollection.add(new SymbolLegendItem(null, {
'text': 'Item',
'textstyle': {'font': '12px Arial'},
'symbol': {
'painter': HorizontalLinePainter,
'width': 10,
'height': 10,
'linestyle': {'color': 'red' }
}
}));
const legendShape = new Legend({
'data': dataCollection,
'linestyle': {'color': 'red'}
'sizeisindevicespace': true,
'alignment': AnchorType.Center,
'autosize': true
});
legendShape.setAnchor(new Point(40, 10));
legendShape.setLayout(new VerticalPriorityLayout());Example
// Example of creating a legend with manual size in model coordinates
const legendShape = new Legend({
'data': dataCollection,
'linestyle': {'color': 'red'}
'sizeisindevicespace': false,
'alignment': AnchorType.Center
});
legendShape.setAnchor(new Point(0.5, 0.5));
legendShape.setSize(0.5, 0.5);
legendShape.setLayout(new VerticalPriorityLayout());↳
Legend
Constructors
Methods
Constructors
• new Legend(options?)
| Name | Type |
|---|---|
Optional options | string | number | Options |
AnchoredShape.constructor
Methods
▸ Protected addChild(node): Legend
Add a child node
| Name | Type | Description |
|---|---|---|
node | LegendItem | LegendItem[] | Iterator<LegendItem> | the child node to be added |
this
▸ addCssClass(cssclass): Legend
Adds new css class to node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ addInvalidateHandler(handler): Legend
Add invalidate handler
Deprecated
since 4.0, use Node.on instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
AnchoredShape.addInvalidateHandler
▸ Protected applyOpacity(context): Legend
This method is called to apply opacity if it is specified on the rendering context. The default implementation sets global alpha on the rendering context
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
this
▸ Protected applyResponsiveStyle(): void
Apply a responsive style rules it is exists
void
AnchoredShape.applyResponsiveStyle
▸ checkCollision(context): boolean
Check if this node is within the area being rendered by the context
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
boolean
true if object is inside of renderable area
▸ Protected clearChildren(disposeChildren?): Legend
Remove all child nodes from this composite group
| Name | Type | Description |
|---|---|---|
Optional disposeChildren | boolean | automatically dispose children. If it is true then method dispose is called for each child. |
this
▸ clone(): Node
All subclasses should override copyConstructor or provide custom implementation for this method
clone
▸ connectStyle(style, type, callback): Legend
Connects style.
This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ Protected copyConstructor(src, deepCopy?): Legend
Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.
| Name | Type | Description |
|---|---|---|
src | AnchoredShape | Source to copy from |
Optional deepCopy | boolean | deep copy |
this
▸ disconnectStyle(style, type, callback): Legend
Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ dispose(): void
Disposes this node, once disposes a node should not be used anymore.
Clear all listeners, and disconnect styles to avoid memory leaks.
Also aggressively 'cleanup' this node by setting some of its members to null.
void
▸ enableClipping(doClip): Legend
Enables or disables clipping of this node. If enabled, shapes will not be rendered outside of its bounds.
| Name | Type | Description |
|---|---|---|
doClip | boolean | enable clipping on this node |
this
▸ enableEventPropagation(enable): Legend
Enable event propagation from the node hierarchy from bottom to top
This option is similar to DOM Event bubbling, which allows to get any event from child node. By default it is disabled for better performance.
Example
import {Group} from '@int/geotoolkit/scene/Group';
import {Events as SceneEvents} from '@int/geotoolkit/scene/Node';
const parentGroup = new Group()
.setName('ParentGroup')
.enableEventPropagation(true);
const childGroup = new Group()
.setName('ChildGroup');
parentGroup.addChild(childGroup);
parentGroup.on(SceneEvents.Invalidate, (eventName, sender, args) => {
// Got notifications from all children of parent group
});
childGroup.invalidate();| Name | Type | Description |
|---|---|---|
enable | boolean | enable |
this
AnchoredShape.enableEventPropagation
▸ enumerateNodes(callback, target?): void
Enumerate children nodes
| Name | Type | Description |
|---|---|---|
callback | Callback<Node> | callback |
Optional target | QueryBuilder<any> | target |
void
INodeEnumerable.enumerateNodes
▸ execute(delegate): Legend
Executes delegate and return the result. It allows us to keep all initialization calls in one place,
and we do not need to scroll up or down in IDE to find how and where it was initialized.
Example
// All setters (.setName() for example) returns reference to the this.
// In order to modify inner object like LineStyle or Pattern, to get this object (property) we should call getter to get object reference.
// Then modify it as shown below in Option 1 or you can use execute methods shown in Option 2.
import {Group} from '@int/geotoolkit/scene/Group';
import {Rect} from '@int/geotoolkit/util/Rect';
// Option 1
const group = new Group()
.setName('MyGroup')
.setBounds(new Rect(0, 0, 42, 16))
.enableClipping(true)
.setTag({'type': 'sometype'});
group.getLineStyle().setPattern('pattern');
return group;
// Options 2 ( using execute method )
return group
.execute(function () {
this.getLineStyle()
.setPattern("pattern");
});| Name | Type | Description |
|---|---|---|
delegate | (this: Legend) => void | Function to execute |
The result if any or this
▸ execute<T>(delegate): T
| Name |
|---|
T |
| Name | Type |
|---|---|
delegate | (this: Legend) => T |
T
▸ Protected filter(context): boolean
Filter node
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
boolean
flag filter flag ("true" to render node; "false" otherwise)
▸ getAnchor(tr?): Point
Gets the anchor
| Name | Type | Description |
|---|---|---|
Optional tr | Transformation | transformation to transform anchor |
▸ getAnchorType(): AnchorType
Returns the current anchor type.
current anchor type
▸ getAnchorX(): number
Return anchored x position
number
▸ getAnchorY(): number
Return anchored y position
number
▸ getAnimationStyle(): AnimationStyle
Return animation style
animationStyle current animation style
AnchoredShape.getAnimationStyle
▸ getAspectRatio(): number
Returns aspect ratio of the content of the shape Returns 1
number
▸ getAutoSize(): boolean
Returns auto size flag
boolean
▸ getBounds(): Rect
Return bound in the parent coordinates
▸ getChildren(filter?): Iterator<LegendItem>
Return iterator by child nodes
| Name | Type | Description |
|---|---|---|
Optional filter | (node: Node) => boolean | a filter function. Returns all nodes if null |
▸ getClassName(): string
string
▸ getClipStyle(): ClipStyle
Gets the current clipping style
clipping style
▸ getCss(): CssStyle
Return CSS style
▸ getCssClass(): string
Returns css class name to be used to apply CSS style
string
the css class name
▸ getCssClasses(): string[]
Gets list of css class names which applied to this node
string[]
▸ getCssTransform(): string
Returns CSS transformation
string
▸ getData(): Collection<LegendItem | ShapeLegendAdapter>
Return the collection to be displayed
Collection<LegendItem | ShapeLegendAdapter>
a collection of items to be displayed
▸ getDesiredHeight(): string | number
Returns desired height of the group as a layoutable object This method is a helper method to get access to getLayoutStyle()
string | number
desired height ("undefined" by default)
▸ getDesiredWidth(): string | number
Returns desired width of the group as a layoutable object. This method is a helper method to get access to getLayoutStyle()
string | number
desired width ("undefined" by default)
▸ getFillStyle(): FillStyle
Return fill style
fillStyle current fill style
▸ getHeight(): number
Return height of the shape
number
▸ getId(): string | number
Returns the associated identifier of the node
string | number
The node's id
▸ Protected getInvalidateMethod(): AttributeCallback<EventDispatcher>
Gets invalidate method
AttributeCallback<EventDispatcher>
method to invalidate this object
AnchoredShape.getInvalidateMethod
▸ getIsPointingUp(): boolean
Returns true if the shape is always pointing up
boolean
true if the shape is always pointing up
▸ getLayout(): Layout
Returns layout associated with the group
layout
▸ getLayoutStyle(): LayoutStyle<string | number>
Return desired layout style
LayoutStyle<string | number>
▸ getLegendDeviceSize(legendToDevice): Rect
Return device area occupied by legend shape
| Name | Type | Description |
|---|---|---|
legendToDevice | Transformation | transformation of the unit rectangle [0,0,1,1] to device |
▸ getLineStyle(): LineStyle
Return line style
lineStyle current line style
▸ getLocalTransform(): Transformation
Retrieves the transformation of bounds to parent
transform the local transform.
AnchoredShape.getLocalTransform
▸ getMarginsStyle(): SpaceStyle<string | number>
Return margins style
SpaceStyle<string | number>
▸ getMaxSize(): Dimension
returns the maximum device space rendering dimension only works when setUseMinMaxSize is enabled.
max size
▸ getMinSize(): Dimension
returns the minimum device space rendering dimension only works when setUseMinMaxSize is enabled.
min size
▸ getModelLimits(): Rect
Gets model limits, the limits of this groups inside space
the current model limits
▸ getName(): string
Returns the node name
string
The node name
▸ getOpacity(): number
Returns current node opacity
number
opacity
▸ getOpacityBlendMode(): BlendMode
Returns current node opacity
opacity blend mode
AnchoredShape.getOpacityBlendMode
▸ getPaddingStyle(): SpaceStyle<string | number>
Return padding style
SpaceStyle<string | number>
padding
▸ getParent(): Node
Return parent node
parent node
▸ getPreserveAspectRatio(): boolean
Returns true if aspect ratio is preserved
boolean
true if aspect ratio is preserved
AnchoredShape.getPreserveAspectRatio
▸ getPreserveReadingOrientation(): boolean
Returns true if the shape is always in a readable orientation
boolean
true if the shape is always in a readable orientation
AnchoredShape.getPreserveReadingOrientation
▸ getPreserveRightAngle(): boolean
Returns true if right angles are preserved
boolean
true if right angles are preserved
AnchoredShape.getPreserveRightAngle
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
object containing the properties
▸ getProperty(name): any
Gets dynamic property by name. These properties can be used as a property bags
| Name | Type | Description |
|---|---|---|
name | string | property name |
any
▸ getPropertyKeys(): string[]
Returns known properties keys
string[]
▸ getRenderingFilter(): IFilter
Return filter to be used for rendering and picking
current filter
AnchoredShape.getRenderingFilter
▸ getResponsiveStyle(): ResponsiveStyle
Return responsive style
AnchoredShape.getResponsiveStyle
▸ getRoot(): Node
Returns root node.
If node doesn't have parent then it returns itself.
the root node
▸ getRotationAngle(): number
Returns rotation angle (in radians)
number
rotationAngle rotation angle at anchor
AnchoredShape.getRotationAngle
▸ getScaleScrollStrategy(): Delegate
Gets scale scroll strategy
scale scroll strategy
AnchoredShape.getScaleScrollStrategy
▸ getSceneTransform(): Transformation
Returns transformation from node to root scene
a transformation from node to root scene
AnchoredShape.getSceneTransform
▸ getSize(): Dimension
Returns the size as a dimension object.
size
▸ getSizeIsInDeviceSpace(): boolean
Returns true if the shape size is set in device space
boolean
true if size is defined in device space
AnchoredShape.getSizeIsInDeviceSpace
▸ getTag(): any
Returns the object associated with the node by user.
any
The node's user-object
▸ getUseMinMaxSize(): boolean
true if using the min max device space sizes
boolean
true if using the min max device space sizes
AnchoredShape.getUseMinMaxSize
▸ getVisible(): boolean
Return visibility of the node
boolean
true if node is visible
▸ getWidth(): number
Return width of the shape
number
▸ getWorldTransform(): Transformation
Retrieves the local transformation of the node which represents multiplication of parent to bounds and contents transformations.
transform the world transform.
AnchoredShape.getWorldTransform
▸ getZIndex(): number
Returns node z-index (null if not set)
number
▸ hasCssClass(cssClass): boolean
Check if node has specified css class
| Name | Type | Description |
|---|---|---|
cssClass | string | css class name |
boolean
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
AnchoredShape.hasEventListener
▸ invalidate(bounds?, force?): Legend
Invalidate area of the shape. This method invalidates parent by default. invalidated from parent to root node.
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | bounds of the invalid rectangle in the inner node coordinates |
Optional force | boolean | true if parent should be invalidated immediately if null is provided then cache (if any will be completely refreshed) otherwise only specified rect or node.bounds will be refreshed |
this
▸ invalidateParent(bounds?, force?): Legend
Invalidate bounds
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | if null is provided then cache (if any will be completely refreshed) otherwise only specified rect or node.bounds will be refreshed |
Optional force | boolean | flag indicating if the parent must be forcibly invalidated |
this
AnchoredShape.invalidateParent
▸ isClippingEnabled(): boolean
Returns if clipping is enabled or not for this node.
boolean
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isEventPropagationEnabled(): boolean
Return true if event propagation is enabled from child to parent
boolean
AnchoredShape.isEventPropagationEnabled
▸ isNotificationEnabled(): boolean
return state of notification
boolean
current notification state
AnchoredShape.isNotificationEnabled
▸ isSelectable(): boolean
Returns true if node can be picked/selected.
boolean
The selectable flag
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): Legend
Notify listeners of the Node
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event |
source | Legend | source who called the event |
Optional args | EventMap[E] | event arguments |
this
▸ off<E>(type?, callback?): Legend
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: Legend, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): Legend
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: Legend, args: EventMap[E]) => void | to be called |
this
▸ Protected onParentChanged(node): Legend
This method is called when parent changes. Do not call it directly.
| Name | Type | Description |
|---|---|---|
node | Node | node to change parent |
this
▸ Protected onVisibilityChanged(): void
This method is called if visibility is changed. Send event Events.VisibilityChanged
void
AnchoredShape.onVisibilityChanged
▸ Protected postRendering(context): void
To be called after rendering. Call this method if you override method render
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
void
▸ Protected preRendering(context): void
Occurs before rendering this method sets clipping by default. Call this method if you override method render
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
void
▸ registerAnimationStyle(root): void
Register animation style.
| Name | Type | Description |
|---|---|---|
root | Node | root node for node |
void
AnchoredShape.registerAnimationStyle
▸ Protected removeChild(node): Legend
Remove child node
| Name | Type | Description |
|---|---|---|
node | LegendItem | LegendItem[] | node or array of nodes to be removed |
this
▸ removeCssClass(cssclass): Legend
Removes css class from node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ removeInvalidateHandler(handler): Legend
Remove invalidate handler
Deprecated
since 4.0, use Node.off instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
AnchoredShape.removeInvalidateHandler
▸ render(context): void
Renders node
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
void
▸ renderAsync(context, callback): void
Render node in asynchronous mode. Default implementation creates call method "render" inside
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
callback | () => void | callback function |
void
▸ rotate(theta, x?, y?): Legend
Rotate bounds around a given coordinate or anchor point
| Name | Type | Description |
|---|---|---|
theta | number | angle to rotate node, in radians |
Optional x | number | x coordinate to rotate around, use anchor-x if not specified |
Optional y | number | y coordinate to rotate around, use anchor-y if not specified |
this
▸ scale(xx, yy): Legend
Scale node
| Name | Type | Description |
|---|---|---|
xx | number | x scale factor |
yy | number | y scale factor |
this
▸ setAnchor(p): Legend
Sets anchor point to given position
| Name | Type | Description |
|---|---|---|
p | Point | point |
this
▸ setAnchor(x, y): Legend
Sets anchor point to given position
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
this
▸ setAnchorType(alignment): Legend
Sets the anchor type.
| Name | Type | Description |
|---|---|---|
alignment | AnchorType | anchor alignment |
this
▸ setAnchorX(ax): Legend
Sets x anchor position
| Name | Type | Description |
|---|---|---|
ax | number | anchor x position |
this
▸ setAnchorY(ay): Legend
Sets y anchor position
| Name | Type | Description |
|---|---|---|
ay | number | anchor x position |
this
▸ setAnimationStyle(animationStyle): Legend
Sets animation style
| Name | Type | Description |
|---|---|---|
animationStyle | Type | animation style |
AnchoredShape.setAnimationStyle
▸ setAutoSize(autoSize): Legend
Set auto size flag
| Name | Type |
|---|---|
autoSize | boolean |
▸ setBounds(bounds): Legend
Sets bounds of the node in the parent coordinates. This method takes anchor position and width and height if size is not in device space
| Name | Type | Description |
|---|---|---|
bounds | Rect | bound of the node in the parent coordinates |
this
▸ setClipStyle(style): Legend
Sets a new clipping style
| Name | Type | Description |
|---|---|---|
style | GraphicsPath | ClipStyle | Options | a new clipping style |
this
▸ setCss(style, merge?): Legend
Sets CSS style. This style will be applied for all inserted elements
| Name | Type | Description |
|---|---|---|
style | Type | CSS style to be applied to inserted elements |
Optional merge | boolean | merge flag |
this
▸ setCssClass(name): Legend
Sets css class name of the node to be used to apply CSS style
| Name | Type | Description |
|---|---|---|
name | string | css class name of the node |
this
▸ setCssTransform(transform): Legend
Set CSS transformation
| Name | Type | Description |
|---|---|---|
transform | string | Transformation | transformation css transformation instruction or Transformation instance |
this
▸ setDesiredHeight(value): Legend
Sets desired height of the group as a layoutable object
| Name | Type | Description |
|---|---|---|
value | string | number | desired height to set |
this
▸ setDesiredWidth(value): Legend
Sets desired width of the group as a layoutable object
| Name | Type | Description |
|---|---|---|
value | string | number | desired width to set |
this
▸ setFillStyle(fillStyle, merge?): Legend
Sets fill style
| Name | Type | Description |
|---|---|---|
fillStyle | Type | a new fill style |
Optional merge | boolean | true if you want to merge fillStyle with existing attribute, false by default |
this
▸ setHeight(height): Legend
Sets height of the shape
| Name | Type | Description |
|---|---|---|
height | number | height of the shape |
this
▸ setId(id): Legend
Allows the user to associate any identifier
| Name | Type | Description |
|---|---|---|
id | string | number | object id |
this
▸ setIsPointingUp(isPointingUp): Legend
Sets whether the shape is always pointing up. Particularly useful for text.
| Name | Type | Description |
|---|---|---|
isPointingUp | boolean | flag setting whether the shape is always pointing up |
this
▸ setLayout(layout): Legend
Associate layout with a group.
| Name | Type | Description |
|---|---|---|
layout | Layout | layout to be set |
this
▸ setLayoutStyle(layoutStyle, merge?): Legend
Specify desired layout style
| Name | Type | Description |
|---|---|---|
layoutStyle | LayoutStyle<string | number> | Options<string | number> | desired layout style |
Optional merge | boolean | true if you want to merge layoutStyle with existing attribute, false by default |
▸ setLineStyle(lineStyle, merge?): Legend
Sets line style
| Name | Type | Description |
|---|---|---|
lineStyle | Type | line style or options |
Optional merge | boolean | true if you want to merge lineStyle with existing attribute, false by default |
this
▸ setLocalTransform(localTransform, force?): Legend
Sets local transformation to be used to transform from local to parent coordinate
| Name | Type | Description |
|---|---|---|
localTransform | Transformation | local transformation for this node |
Optional force | boolean | boolean flag to force update event if transformations are equal, false by default |
this
AnchoredShape.setLocalTransform
▸ setMarginsStyle(margins, merge?): Legend
Sets margins style
| Name | Type | Description |
|---|---|---|
margins | Type<string | number> | margins style |
Optional merge | boolean | true if you want to merge marginsStyle with existing attribute, false by default |
this
▸ setMaxSize(maxSize): Legend
sets the maximum device space rendering dimension
| Name | Type | Description |
|---|---|---|
maxSize | Dimension | maximum device space rendering dimension |
▸ setMinSize(minSize): Legend
sets the minimum device space rendering dimension only works when setUseMinMaxSize is enabled.
| Name | Type | Description |
|---|---|---|
minSize | Dimension | minimum device space rendering dimension |
this
▸ setModelLimits(limits): Legend
Sets inner model limits for legends' items
| Name | Type | Description |
|---|---|---|
limits | Rect | inner limits |
this
▸ setName(name): Legend
Sets name of the node
| Name | Type | Description |
|---|---|---|
name | string | The node name |
this
▸ setNotification(notify, force?): Legend
set notification state
| Name | Type | Description |
|---|---|---|
notify | boolean | flag set to invalidate parent or not |
Optional force | boolean | true if parent should be invalidated immediately |
this
▸ setOpacity(opacity, blendMode?): Legend
Sets node opacity
| Name | Type | Description |
|---|---|---|
opacity | number | node opacity from 0 to 1 |
Optional blendMode | BlendMode | opacity blend mode. If it is normal, opacity will be replaced. |
this
▸ setOptions(options): Legend
Sets visualization options
| Name | Type | Description |
|---|---|---|
options | OptionsBase | options |
this
▸ setPaddingStyle(paddingStyle, merge?): Legend
Sets padding style. Legend supports only numbers as padding
| Name | Type | Description |
|---|---|---|
paddingStyle | Type<string | number> | padding style |
Optional merge | boolean | true if you want to merge paddingStyle with existing attribute, false by default |
▸ setPreserveAspectRatio(preserveAspectRatio): Legend
Sets whether aspect ratio is preserved
| Name | Type | Description |
|---|---|---|
preserveAspectRatio | boolean | flag Sets whether aspect ratio is preserved |
this
AnchoredShape.setPreserveAspectRatio
▸ setPreserveReadingOrientation(preserveReadingOrientation): Legend
Sets whether the shape is always in a readable orientation. Particularly useful for text. Prevents mirror effects
| Name | Type | Description |
|---|---|---|
preserveReadingOrientation | boolean | sets flag whether the shape is always in a readable orientation |
this
AnchoredShape.setPreserveReadingOrientation
▸ setPreserveRightAngle(preserveRightAngle): Legend
Sets whether right angles are preserved
| Name | Type | Description |
|---|---|---|
preserveRightAngle | boolean | flag setting if right angles are preserved |
this
AnchoredShape.setPreserveRightAngle
▸ setProperties(properties?): Legend
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | object containing the properties to set |
this
▸ setProperty(name, value): Legend
Sets dynamic property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
▸ setRenderingFilter(filter): Legend
Sets filter to be applied before rendering and picking
| Name | Type | Description |
|---|---|---|
filter | IFilter | filter to set |
this
AnchoredShape.setRenderingFilter
▸ setResponsiveStyle(style): Legend
Sets responsive style.
| Name | Type | Description |
|---|---|---|
style | Options | ResponsiveStyle | responsive style |
this
AnchoredShape.setResponsiveStyle
▸ setRotationAngle(rotationAngle): Legend
Set rotation angle
| Name | Type | Description |
|---|---|---|
rotationAngle | number | rotation angle (in radians) at anchor |
this
AnchoredShape.setRotationAngle
▸ setScaleScrollStrategy(strategy?): Legend
Sets scale scroll strategy
| Name | Type | Description |
|---|---|---|
Optional strategy | Delegate | scale scroll strategy |
this
AnchoredShape.setScaleScrollStrategy
▸ setSelectable(selectable): Legend
Allows to select node. If node is not selectable then child node is not selectable.
| Name | Type | Description |
|---|---|---|
selectable | boolean | flag to allow node selection |
this
▸ setSilent(bool): Legend
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setSize(width, height?): Legend
Sets size of the shape, will accept a width and height number or a Dimension object.
| Name | Type | Description |
|---|---|---|
width | number | Dimension | Options | width of the shape |
Optional height | number | height of the shape |
this
▸ setSizeIsInDeviceSpace(sizeIsInDeviceSpace): Legend
Sets whether the shape size is set in device space.
| Name | Type | Description |
|---|---|---|
sizeIsInDeviceSpace | boolean | true if the shape size is fixed in device space; otherwise, false. |
this
AnchoredShape.setSizeIsInDeviceSpace
▸ setTag(tag): Legend
Allows the user to associate any arbitrary object with the node.
| Name | Type | Description |
|---|---|---|
tag | any | The object to be associated with the node. |
this
▸ setUseMinMaxSize(useMinMaxSize): Legend
Sets whether to use the min max device space sizes
| Name | Type | Description |
|---|---|---|
useMinMaxSize | boolean | true if using the min max device space sizes otherwise, false. |
this
AnchoredShape.setUseMinMaxSize
▸ setVisible(value): Legend
Sets visibility of the node. Send event Events.VisibilityChanged
| Name | Type | Description |
|---|---|---|
value | boolean | flag specifying visibility of the node |
this
▸ setWidth(width): Legend
Sets width of the shape
| Name | Type | Description |
|---|---|---|
width | number | width of the shape |
this
▸ setZIndex(value): Legend
Sets z-index for node (set null for default)
| Name | Type | Description |
|---|---|---|
value | number | index determining node z-position |
this
▸ shear(shx, shy): Legend
Shear this node's bounds
| Name | Type | Description |
|---|---|---|
shx | number | x-axis shear |
shy | number | y-axis shear |
this
▸ toString(): string
Returns a string representation of this object (generally the classname)
string
A string representation
▸ translate(tx, ty): Legend
Translate bounds
| Name | Type | Description |
|---|---|---|
tx | number | x translation |
ty | number | y translation |
this
▸ unregisterAnimationStyle(root): void
Unregister animation style.
| Name | Type | Description |
|---|---|---|
root | Node | root node for node |
void
AnchoredShape.unregisterAnimationStyle
▸ updateLayout(targets?): Legend
Updates layout(s)
| Name | Type | Description |
|---|---|---|
Optional targets | ILayoutable[] | optional parameter about which element to layout |
this
▸ updateSceneTransformation(): Legend
Update scene transformation
this
AnchoredShape.updateSceneTransformation
▸ updateSize(): void
Calculate and update size based on legend items
void
▸ updateState(regions?, changes?): Legend
Update state. These methods reset node state and update state for children. this method is useful to refresh a scene graph
| Name | Type | Description |
|---|---|---|
Optional regions | Rect[] | optional array to return invalid rectangles in the parent coordinates |
Optional changes | StateChanges | optional parameter to specify a reason of changes |
this
▸ Protected updateTimeStamp(): Legend
Update time stamp to indicate that Node or Children has been changed.
this
▸ Static enableSceneGraphNotification(enabled): void
Enable / disable all notifications
| Name | Type | Description |
|---|---|---|
enabled | boolean | sets if this object sends notifications |
void
AnchoredShape.enableSceneGraphNotification
▸ Static findParent<T>(node, classType, filter?): InstanceType<T>
Find root of the node with specified type
| Name | Type |
|---|---|
T | extends Constructor<any> |
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | T | type of the class to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
InstanceType<T>
▸ Static findParent(node, classType, filter?): Node
Find root of the node with specified type
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | string | interface name to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
▸ Static getAnchorPosition(rect, anchorType): Point
Return anchor position
| Name | Type | Description |
|---|---|---|
rect | Rect | rectangle to get anchor position |
anchorType | AnchorType | anchor type |
anchor
AnchoredShape.getAnchorPosition
▸ Static getClassName(): string
string
▸ Static intersectsBounds(bounds, localTransformation, parentInvalidArea, expand?): boolean
Check collision of the shape bounds with parent invalid area
| Name | Type | Description |
|---|---|---|
bounds | Rect | shape bounds |
localTransformation | Transformation | local transformation of the bounds |
parentInvalidArea | Rect | invalid parent area |
Optional expand | Dimension | optional expand the bounds in model coordinate |
boolean
true if bounds intersect the invalid area
AnchoredShape.intersectsBounds
▸ Static isSceneGraphNotificationEnabled(): boolean
Return status of the global notification for all nodes.
boolean