C

ItemMapping<TItem, TValue>

Provides different ways to define a mapping from items to values for use with LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>.
Inheritance Hierarchy

Remarks

Only one of the provided ways to define a mapping can be used at the same time, therefore only one of the properties mapper, mapperFunction and constant should be set on each instance.

This class supports LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> implementations and does not usually have to be instantiated by client code explicitly. Instances of this class are properties of concrete LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> implementations.

Functions, IMapper<K, V>s and constant values are automatically converted to ItemMapping<TItem, TValue>s. For example:

// Constant
new HierarchicalLayoutData({
  sourceGroupIds: groupId,
})

// Delegate
new HierarchicalLayoutData({
  sourceGroupIds: (edge: IEdge) => edge.tag.sourceGroupId,
})

// Mapper
new HierarchicalLayoutData({ sourceGroupIds: new Mapper() })
// or a JavaScript Map
new HierarchicalLayoutData({ sourceGroupIds: new Map() })

Furthermore, the conversion supports a parameter object to initialize the properties. For example:

// Create a new ItemMapping from a JavaScript Map and initialize its 'mapper' with the new Map.
// This also works for the different properties as well.
new HierarchicalLayoutData({
  sourceGroupIds: new Map(),
})
// Or, instead of providing the specific property, the 'includes' key can be used
new HierarchicalLayoutData({
  sourceGroupIds: {
    includes: new Map(),
  },
})

This class cannot be instantiated

Type Parameters

TItem

The type of the items that are mapped.

TValue

The type of the values the items are mapped to.

See Also

Developer's Guide

Members

No filters for this type

Properties

Gets or sets a constant value all items are mapped to.
Setting this property will override any previously set properties.
final

See Also

Developer's Guide
Gets or sets an IMapper<K, V> that realizes the mapping.
This property is initialized by default and the returned IMapper<K, V> can be used directly. Setting this property will override any previously set properties.
conversionfinal

See Also

Developer's Guide
Gets or sets a delegate that implements the mapper function.
Setting this property will override any previously set properties.
final

See Also

Developer's Guide