documentationfor yFiles for HTML 2.6

Migrating to 2.3 from 2.2

yfiles-typeinfo.js and Development Mode

The type checks and graph inspection tools at runtime, that were previously provided by the file ide-support/yfiles-typeinfo.js, are now included in the development mode of the yFiles for HTML library. We no longer recommend using the stand-alone yfiles-typeinfo.js file. To migrate:

  1. Don’t load the file `yfiles-typeinfo.js anymore, e.g., remove the <script> tag or the entry in your webpack config, etc.
  2. Use the dev-lib library instead of the regular library located in the lib folder.

See the section about the development mode for more details.

The file can still be found in tools/prepare-package/yfiles-typeinfo.js.

The New Graph Builder Classes

The GraphBuilder and TreeBuilder classes have been replaced in the library with more powerful but incompatible builder classes. AdjacentNodesGraphBuilder was replaced with AdjacencyGraphBuilder.

Drop-in replacement classes that resemble the API of the previous GraphBuilder, TreeBuilder, and AdjacentNodesGraphBuilder, named SimpleGraphBuilder, SimpleTreeBuilder, and SimpleAdjacentNodesGraphBuilder, are available as demo code in /utils/.

Changes When using a Projection

The view coordinate system now includes a projection. The projection is an additional transformation that transforms the former view coordinate system by the projection matrix, e.g., to achieve an isometric perspective. For customers who do not use a projection, i.e., an identity matrix as projection, nothing will change. However, when the (former) view coordinate system has been used to render parts of the visualization in a zoom-invariant manner, the equivalent now is called the intermediate coordinate system. The view coordinate system is still necessary when coordinates relative to the component are needed, e.g., for tooltips or a context menu.

When using the new projections feature, the CanvasComponent.contentRect property no longer has an effect on scrollbars or the GraphComponent.fitGraphBounds method.

SvgExport.viewWidth and SvgExport.viewHeight are no longer used for the exported image dimensions when using a projection. If you need to know the size of the resulting image, this can be obtained from the image after export.

Visuals that are rendered in view coordinates relative to the viewport may appear in a different location when exporting an image.

The CanvasComponent ignores its ViewportLimiter when using projections.

Renamed Types and API Members

  • Class TransitiveClosureEdge was renamed to TransitiveEdge.
  • The overloaded method IPathGeometry.getTangent(number, number) with index and ratio was renamed to getTangentForSegment. The corresponding methods EdgeStyleBase.getTangent(IEdge, number, number) and GeneralPath.getTangent(number, number) were renamed as well. This makes overriding those methods much easier.
  • Also, to make overriding easier, the overloaded methods GraphModelManager.getCanvasObjectGroup now have distinguishable names, namely getNodeCanvasObjectGroup, getEdgeCanvasObjectGroup, etc.
  • The ModelManager.unInstall method has been renamed to the canonical name uninstall.
  • Some methods of the YList class have been replaced and are now named consistent with the new methods of IList and the corresponding methods of JavaScript arrays. Note that YList is a special-purpose list implementation that is typically only used when implementing a layout customization. In detail, pop has been renamed to shift, popLast has been renamed to pop.

Removed API Members

The KMeansClusteringDistanceMetric enum
It should be replaced with the DistanceMetric enum which has the same members.
The static methods createDelegate and dynamicInvoke of delegate
They were never intended to be part of the public API and didn’t work as intended in all cases.
The methods getPreferredSize and getPreferredSizeCore of (String)TemplateNodeStyle, (String)TemplatePortStyle, and the corresponding renderer implementations
They were never used by the library and returned no meaningful value.

Other API Changes

  • The ToolTip class now has a constructor without parameters to make custom implementations easier.
  • The NodeReshapeSnapResultProvider.getSnapLines method now takes CollectSnapResultsEventArgs as additional parameter.
  • The methods SnapResults.createResizeSnapResult, NodeReshapeSnapResultProvider.addSnaplineSnapResult, NodeReshapeSnapResultProvider.addGridLineSnapResult, and NodeReshapeSnapResultProvider.addSameSizeSnapResult now take a Point instead of a number as a delta parameter. Depending on the SnapLineOrientation, x or y of the Point needs to be set to 0 to get the same results.
  • The HierarchicalClusteringResult.dendrogramRoot property can now return null if the result has been obtained from an empty graph.
  • The singleton returned by the static DefaultEdgePathCropper.INSTANCE property has been moved to the IEdgePathCropper.INSTANCE property.
  • The method CanvasComponent.createInputModeContext is protected again, after having been made public accidentally previously.
  • The methods createNodeMapper and createEdgeMapper of YGraphAdapter are no longer interchanged. Previously, createNodeMapper created an IMapper for keys of type IEdge instead of INode and vice versa.
  • The YList.push method has been changed to be in line with IList.push. It now returns the length of the list instead of a ListCell.

Changes of Default Behavior

  • The GraphOverviewComponent is now rendered with HTML Canvas instead of SVG by default. This results in better performance and was always the intended behavior. You can switch to SVG rendering with the GraphOverviewComponent.renderMode property.
  • By default, the NavigationInputMode.adjustContentRect method doesn’t fit the graph bounds into the viewport anymore. Also, NavigationInputMode class doesn’t fit the content after expand and collapse operations anymore if an AutoGroupNodeAlignmentPolicy other than NONE is used. To restore this behavior, enable NavigationInputMode.fitContentAfterGroupActions.
  • The ViewportLimiter no longer jumps to the limited viewports if the current viewport is outside the limited area. This behavior can be restored by setting the ViewportLimiter.limitingPolicy property to LimitingPolicy.STRICT.
  • The default value of the MoveViewportInputMode.pinchZoomThreshold property has been changed from 100 to 50 to prevent pinch gestures from stopping periodically.
  • The GraphCentrality and ClosenessCentrality analysis algorithms now calculate the centrality individually per component instead of returning a centrality value of 0.0 for nodes in graphs that are not connected.
  • If the mapper property of HierarchicLayoutData.edgeDirectedness is directly accessed (and not explicitly set), its default for unset values is now 1.0 instead of 0.0. That means that such edges are now treated as directed instead of undirected.
  • For the rootPlacements, subtreeRoutingPolicies, and subtreeAspectRatio properties of the AspectRatioTreeLayoutData class, the type of the mapped values has been made nullable. For null or unset values, the settings on the AspectRatioTreeLayout will now be taken. This is the documented behavior, though.
  • The value of the read-only property EdgeRouter.partition is now null after applying the routing algorithm. It is only intended to be used during the execution. Previously, it was cached, even though the documentation stated otherwise.

Deprecations

  • The LabelStyleBase.createLayoutTransform method has a new overload with the render context as first parameter to take non-identity projections of the corresponding CanvasComponent into consideration. Without this context, this method cannot respect a projection and, consequently, the overload with the previous signature is now deprecated.
  • The properties EdgeRouter.polylineRouting, EdgeRouter.preferredPolylineSegmentLength and EdgeRouter.maximumPolylineSegmentRatio are now deprecated. To enable polyline routing, specify EdgeRouterEdgeRoutingStyle.OCTILINEAR as routing style via EdgeLayoutDescriptor.routingStyle. The other two properties are also replaced by respective properties on the EdgeLayoutDescriptor class.