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:
-
Don’t load the file
`yfiles-typeinfo.jsanymore, e.g., remove the<script>tag or the entry in your webpack config, etc. -
Use the
dev-liblibrary instead of the regular library located in thelibfolder.
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
TransitiveClosureEdgewas renamed toTransitiveEdge. -
The overloaded method
IPathGeometry.getTangent(number, number)with index and ratio was renamed togetTangentForSegment. The corresponding methodsEdgeStyleBase.getTangent(IEdge, number, number)andGeneralPath.getTangent(number, number)were renamed as well. This makes overriding those methods much easier. -
Also, to make overriding easier, the overloaded methods
GraphModelManager.getCanvasObjectGroupnow have distinguishable names, namelygetNodeCanvasObjectGroup,getEdgeCanvasObjectGroup, etc. -
The
ModelManager.unInstallmethod has been renamed to the canonical nameuninstall. -
Some methods of the
YListclass have been replaced and are now named consistent with the new methods ofIListand the corresponding methods of JavaScript arrays. Note thatYListis a special-purpose list implementation that is typically only used when implementing a layout customization. In detail,pophas been renamed toshift,popLasthas been renamed topop.
Removed API Members
- The
KMeansClusteringDistanceMetricenum -
It should be replaced with the
DistanceMetricenum which has the same members. - The static methods
createDelegateanddynamicInvokeofdelegate -
They were never intended to be part of the public API and didn’t work as intended in all cases.
- The methods
getPreferredSizeandgetPreferredSizeCoreof(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
ToolTipclass now has a constructor without parameters to make custom implementations easier. -
The
NodeReshapeSnapResultProvider.getSnapLinesmethod now takesCollectSnapResultsEventArgsas additional parameter. -
The methods
SnapResults.createResizeSnapResult,NodeReshapeSnapResultProvider.addSnaplineSnapResult,NodeReshapeSnapResultProvider.addGridLineSnapResult, andNodeReshapeSnapResultProvider.addSameSizeSnapResultnow take aPointinstead of anumberas a delta parameter. Depending on theSnapLineOrientation,xoryof thePointneeds to be set to0to get the same results. -
The
HierarchicalClusteringResult.dendrogramRootproperty can now returnnullif the result has been obtained from an empty graph. -
The singleton returned by the static
DefaultEdgePathCropper.INSTANCEproperty has been moved to theIEdgePathCropper.INSTANCEproperty. -
The method
CanvasComponent.createInputModeContextis protected again, after having been made public accidentally previously. -
The methods
createNodeMapperandcreateEdgeMapperofYGraphAdapterare no longer interchanged. Previously,createNodeMappercreated anIMapperfor keys of typeIEdgeinstead ofINodeand vice versa. -
The
YList.pushmethod has been changed to be in line withIList.push. It now returns the length of the list instead of aListCell.
Changes of Default Behavior
-
The
GraphOverviewComponentis 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 theGraphOverviewComponent.renderModeproperty. -
By default, the
NavigationInputMode.adjustContentRectmethod doesn’t fit the graph bounds into the viewport anymore. Also,NavigationInputModeclass doesn’t fit the content after expand and collapse operations anymore if anAutoGroupNodeAlignmentPolicyother thanNONEis used. To restore this behavior, enableNavigationInputMode.fitContentAfterGroupActions. -
The
ViewportLimiterno longer jumps to the limited viewports if the current viewport is outside the limited area. This behavior can be restored by setting theViewportLimiter.limitingPolicyproperty toLimitingPolicy.STRICT. -
The default value of the
MoveViewportInputMode.pinchZoomThresholdproperty has been changed from100to50to prevent pinch gestures from stopping periodically. -
The
GraphCentralityandClosenessCentralityanalysis algorithms now calculate the centrality individually per component instead of returning a centrality value of0.0for nodes in graphs that are not connected. -
If the mapper property of
HierarchicLayoutData.edgeDirectednessis directly accessed (and not explicitly set), its default for unset values is now1.0instead of0.0. That means that such edges are now treated as directed instead of undirected. -
For the
rootPlacements,subtreeRoutingPolicies, andsubtreeAspectRatioproperties of theAspectRatioTreeLayoutDataclass, the type of the mapped values has been madenullable. Fornullor unset values, the settings on theAspectRatioTreeLayoutwill now be taken. This is the documented behavior, though. -
The value of the read-only property
EdgeRouter.partitionis 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.createLayoutTransformmethod has a new overload with the render context as first parameter to take non-identity projections of the correspondingCanvasComponentinto 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.preferredPolylineSegmentLengthandEdgeRouter.maximumPolylineSegmentRatioare now deprecated. To enable polyline routing, specifyEdgeRouterEdgeRoutingStyle.OCTILINEARas routing style viaEdgeLayoutDescriptor.routingStyle. The other two properties are also replaced by respective properties on theEdgeLayoutDescriptorclass.