Multiple diagrams initialization in one js function

Hi there! Is there any way we can initialize multiple diagrams in a page with just 1 init function. I want to avoid multiple redundant init function code.

Absolutely yes. It’s all just JavaScript code, so you can organize your code how you wish. Templates and Brushes and Geometrys may be shared between Diagrams, but CommandHandlers and Tools and Layouts may not be shared.

Most (maybe all?) of the samples that have two diagrams in them do all their initialization in a single init function.