GoJS 2.3 Beta has been released

GoJS 2.3


The 2.3 beta can be installed as a package: npm i gojs@beta

New SVG Rendering Context

GoJS typically renders the Diagram to an HTML Canvas, and offers exporting the Diagram scene to image formats and SVG. In GoJS 2.3, the library now supports rendering to a live SVG context in addition to the default Canvas context. Visually there should be no changes, and performance will be faster when using the default Canvas context, but the SVG context may be useful for applications where DOM accessibility is paramount, either because users need to select and copy text, or because screen readers need access to all text in the application.

The new SVG rendering context comes with significant changes and upgrades to the GoJS SVG structure, including export SVG. For example, an object with a clip-path would formerly point to a <clippath> via URL, and now clipping paths are defined in-line. These changes make some elementFinished code in Diagram.makeSVG potentially incompatible.

Read more about the SVG Rendering Context here

New Layered Digraph Layout Options for Better Performance

Version 2.3 adds LayeredDigraphLayout.alignOption as a potentially faster alternative to LayeredDigraphLayout.packOption. When using this option, nodes are assigned coordinates within their layers to produce more long vertically aligned blocks of nodes and small edge lengths.

General New Features in GoJS 2.3

  • Added PathFigure.isEvenOdd - PathFigures now support the “even-odd” fill rule. This can be set with the new property PathFigure.isEvenOdd or when making SVG-like Path syntax, with the fill rule F0 (instead of the default F or F1), eg "F0 M 0 0 L 50 50 ...".
  • Added Size.inflate.
  • Bugfixes for shadow drawing when Shapes have a background set.
  • Bugfixes for Table Panel separators when the Panel is scaled.
  • Arguments passed to Diagram.scroll have been made consistent. Scrolling 'left' 150 pixels will scroll left, but scrolling 'left' -150 pixels will scroll right.
  • GraphObject.build now takes a third argument, which is passed to GraphObject.takeBuilderArgument, if used.

I am using 2.2.X , can I easily update to 2.3.x ? it is compatible?

Yes, there should be no compatibility issues, except one: if you are using makeSVG with elementFinished, you may need to retool some of your code because the SVG element tree has changed.

Thank you simon, I didn’t use makeSVG, but using go.Picture to show some SVG files. Then, no issues to update right?

Yes, there should be no issues with updating.

Note that 2.3 is on npm as the beta tag (gojs@beta) if you are using npm. We expect it to become the “latest” release within a few weeks.

I see, thank you simon.

Hi folks, I think I found a bug in the 2.3 release with the makeSvg() utility. I’m not using elementFinished so this sounds unrelated to @simon’s compatibility warning above.

I’m running the “minimal SVG” example with GoJS 2.3 and the SVG appears blank.

By inspecting the generated SVG, I noticed that the background is layered on top of the diagram. Swapping the order of the nodes fixes the problem:


Let me know if you need additional information or if I missed a release note!

Edit: to be specific, this is with the 2.3.0 version hosted at https://unpkg.com/gojs@2.3.0/release/go.js

I see what you mean, thanks, we’ll look into it.

We’ve just released 2.3.1 which fixes this issue and some others with Diagram.makeSVG.

Confirming that 2.3.1 fixed my issue. Thank you for handling this so fast @simon and team!