{"id":8398,"date":"2021-04-15T09:57:52","date_gmt":"2021-04-15T06:57:52","guid":{"rendered":"https:\/\/dhtmlx.com\/blog\/?p=8398"},"modified":"2026-01-23T13:30:55","modified_gmt":"2026-01-23T10:30:55","slug":"dhtmlx-diagram-3-1-with-mind-maps","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/dhtmlx-diagram-3-1-with-mind-maps\/","title":{"rendered":"DHTMLX Diagram 3.1 with Mind Maps, Configurable Per-Shape Toolbar, Custom Event Handlers, and TypeScript Support"},"content":{"rendered":"<p>DHTMLX Diagram has been updated to version 3.1. We have incorporated plenty of feedback from the users of our <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDiagram\/\" rel=\"noopener\" target=\"_blank\">JavaScript diagramming component<\/a> into the release. Now you can create and customize mind maps, edit them on the fly via the mind map editor, fine-tune a per-shape toolbar, and add custom event handlers to custom shapes. Besides, built-in type definitions become available to help you code diagrams faster.<\/p>\n<p>Test the new <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDiagram\/download.shtml\" rel=\"noopener\" target=\"_blank\">trial version 3.1 free for 30 days<\/a> and explore the release details in our article.<\/p>\n<h5>Brand-New Mind Map Diagram<\/h5>\n<p>The keynote of the release 3.1 is the introduction of a new diagram type &#8211; <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/#diagram-in-the-mindmap-mode\" rel=\"noopener\" target=\"_blank\">mind map<\/a>. Mind maps are intended for the visualization of information with multiple hierarchically arranged concepts branching off from the core idea. This diagram type can be applied to structure business, scientific, technical, and any other kinds of data.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/DHTMLX-Mind-Map.jpg\" alt=\"DHTMLX Mind Map\" width=\"906\" height=\"805\" class=\"aligncenter size-full wp-image-8402\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/DHTMLX-Mind-Map.jpg 906w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/DHTMLX-Mind-Map-300x267.jpg 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/DHTMLX-Mind-Map-768x682.jpg 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/twd25ww1\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>Creating mind maps using the DHTMLX Diagram library is now possible due to a new type of shapes specific to mind maps called the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/shapes\/default_shapes\/\" rel=\"noopener\" target=\"_blank\">&#8220;topic&#8221; shapes<\/a>. They are the default type of shapes in DHTMLX mind maps. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/topic-shape-2.jpg\" alt=\"DHTMLX mind map topic shape\" width=\"244\" height=\"105\" class=\"aligncenter size-full wp-image-8403\" \/><\/p>\n<p>The library&#8217;s API allows configuring topic shapes according to your requirements. You can adjust the shapes&#8217; size, offset, background and border color, text decoration and alignment as well as apply your own CSS classes to shapes. <\/p>\n<p>To arrange shapes in the right hierarchical order, you can either specify the parent id of each shape via the <strong>parent<\/strong> configuration property or <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/lines\/\" rel=\"noopener\" target=\"_blank\">link shapes to each other<\/a> using the configuration properties of the connector object. The <strong>from<\/strong> and <strong>to<\/strong> properties of the connector object enable you to define which shapes to link with a particular connector. Besides, you can choose if a connector is a dashed or solid line with the help of the optional <strong>type<\/strong> property:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> data <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;<span class=\"co1\">\/\/ shapes<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;49 emotions&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Positive and lively&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;3&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Quiet positive&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;4&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Caring&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;5&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Reactive&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ connectors<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1-2&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;from&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;to&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;type&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;dash&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1-3&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;from&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;to&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;3&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;type&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;dash&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1-4&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;from&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;to&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;4&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;type&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;line&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1-5&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;from&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;to&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;5&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;type&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;line&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n<span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-connectors.jpg\" alt=\"DHTMLX mind map connectors\" width=\"521\" height=\"146\" class=\"aligncenter size-full wp-image-8405\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-connectors.jpg 521w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-connectors-300x84.jpg 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/p>\n<p>While a solid line is the default connector type, you can alter it via the <strong>defaultLinkType<\/strong> property of the diagram object:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; defaultLinkType<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;line&quot;<\/span> &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>DHTMLX mind maps provide an opportunity to arrange child shapes both to the right and to the left of the root shape. For this purpose, we have introduced the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/api\/diagram\/typeconfig_property\/\" rel=\"noopener\" target=\"_blank\"><strong>typeConfig<\/strong><\/a> option, which determines the direction of mind map branches. The <strong>direction<\/strong> attribute of the <strong>typeConfig<\/strong> option can be set to <em>left<\/em> or <em>right<\/em>:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; typeConfig<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; direction<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;right&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\ndiagram.<span class=\"me1\">data<\/span>.<span class=\"me1\">parse<\/span><span class=\"br0\">&#40;<\/span>data<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/right-direction.jpg\" alt=\"DHTMLX mindmap with right direction\" width=\"650\" height=\"357\" class=\"aligncenter size-full wp-image-8406\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/right-direction.jpg 650w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/right-direction-300x165.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/pzllujx3\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>If you would like to place some shapes to the left and some to the right, you can make use of the <strong>side<\/strong> attribute of the <strong>typeConfig<\/strong> object. The <strong>side<\/strong> attribute allows indicating which shapes to be drawn to the left and to the right of the root shape by specifying their ids:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; typeConfig<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; side<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;3&quot;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; right<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><span class=\"st0\">&quot;4&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;5&quot;<\/span><span class=\"br0\">&#93;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\ndiagram.<span class=\"me1\">data<\/span>.<span class=\"me1\">parse<\/span><span class=\"br0\">&#40;<\/span>data<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/left-and-right.jpg\" alt=\"DHTMLX mindmap with left and right branches\" width=\"900\" height=\"640\" class=\"aligncenter size-full wp-image-8407\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/left-and-right.jpg 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/left-and-right-300x213.jpg 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/left-and-right-768x546.jpg 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/twd25ww1\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>When configuring a mind map, you can also decide which child shapes to show and which to hide. The <strong>open<\/strong> attribute shows child shapes of a particular parent shape being <em>true<\/em> by default. With the help of the <strong>openDir<\/strong> attribute you can specify more precisely whether to show child shapes to the left or right of the parent shape:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> data <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;text&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;49 emotions&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"st0\">&quot;openDir&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span class=\"sy0\">:<\/span> <span class=\"kw2\">true<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; right<span class=\"sy0\">:<\/span> <span class=\"kw2\">false<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;text&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Positive and lively&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;parent&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;3&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;text&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Quiet positive&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;parent&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;4&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;text&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Caring&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;parent&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <span class=\"st0\">&quot;id&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;5&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;text&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Reactive&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;parent&quot;<\/span><span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n<span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/hiding-mind-map-branches.jpg\" alt=\"Hiding mind map branches - DHTMLX Diagram\" width=\"521\" height=\"146\" class=\"aligncenter size-full wp-image-8408\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/hiding-mind-map-branches.jpg 521w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/hiding-mind-map-branches-300x84.jpg 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/p>\n<h5>Custom Shapes in Mind Maps<\/h5>\n<p>The DHTMLX Diagram library makes it possible to mix various shapes in one diagram. Thus, you can create a mind map and add org chart shapes or any other diagram shapes into it. All you need to do is to specify the desired type of shape in the shape configuration object:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> data <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ create an &quot;img-card&quot; shape of Org Chart with the related configuration<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Chairman &amp; CEO&quot;<\/span><span class=\"sy0\">,<\/span> type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;img-card&quot;<\/span><span class=\"sy0\">,<\/span> img<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;..\/avatar-06.jpg&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ create default &quot;topic&quot; shapes of Mind Map<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Manager&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2.1&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Marketer&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2.2&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Team Lead &quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ more options<\/span><br \/>\n<span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\n<span class=\"co1\">\/\/ initializing the mind map<\/span><br \/>\n<span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\ndiagram.<span class=\"me1\">data<\/span>.<span class=\"me1\">parse<\/span><span class=\"br0\">&#40;<\/span>data<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mixed_mindmap.png\" alt=\"DHTMLX mixed mind map\" width=\"661\" height=\"256\" class=\"aligncenter size-full wp-image-8409\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mixed_mindmap.png 661w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mixed_mindmap-300x116.png 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><\/p>\n<p>You can also change the default type of shapes via the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/api\/diagram\/defaultshapetype_property\/\"><strong>defaultShapeType<\/strong><\/a> configuration option of the diagram. The new default type will be applied to all shapes except the ones where another type is specified in the shape configuration object:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; defaultShapeType<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;rectangle&quot;<\/span> <br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\n<span class=\"kw1\">const<\/span> data <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Chairman &amp; CEO&quot;<\/span><span class=\"sy0\">,<\/span> type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;card&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span> &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;2&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Manager&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;3&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Technical Director&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;4&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;CCO&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;5&quot;<\/span><span class=\"sy0\">,<\/span> text<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Product Manager&quot;<\/span><span class=\"sy0\">,<\/span> parent<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;1&quot;<\/span> <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-with-rectangles.jpg\" alt=\"DHTMLX mind map with rectangle shapes\" width=\"591\" height=\"274\" class=\"aligncenter size-full wp-image-8410\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-with-rectangles.jpg 591w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mind-map-with-rectangles-300x139.jpg 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>Moreover, you can create an entirely custom mind map by adding custom shapes via the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/api\/diagram\/addshape_method\/\" rel=\"noopener\" target=\"_blank\"><strong>addShape()<\/strong><\/a> method and making them the default ones. In the example below, we have created a sitemap with landing page previews instead of topic shapes and custom HTML content inside shapes: icon, which opens a popup, icon with an embedded link to a landing page, and custom text, which appears when a user clicks on a shape:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> diagram <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Diagram<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ specifies the new shape type as a type for all shapes<\/span><br \/>\n&nbsp; &nbsp; defaultShapeType<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;flowView&quot;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\n<span class=\"kw1\">function<\/span> template<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#123;<\/span> title<span class=\"sy0\">,<\/span> view<span class=\"sy0\">,<\/span> cr<span class=\"sy0\">,<\/span> br<span class=\"sy0\">,<\/span> conversion<span class=\"sy0\">,<\/span> link <span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; ...<br \/>\n<span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n<span class=\"kw1\">function<\/span> openModalInfo<span class=\"br0\">&#40;<\/span>title<span class=\"sy0\">,<\/span> text<span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp;...<br \/>\n<span class=\"br0\">&#125;<\/span><br \/>\n&nbsp;<br \/>\ndiagram.<span class=\"me1\">addShape<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;flowView&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; template<span class=\"sy0\">:<\/span> template<span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; eventHandlers<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; onclick<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info<span class=\"sy0\">:<\/span> <span class=\"kw1\">function<\/span><span class=\"br0\">&#40;<\/span>event<span class=\"sy0\">,<\/span> item<span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; openModalInfo<span class=\"br0\">&#40;<\/span>item.<span class=\"me1\">title<\/span><span class=\"sy0\">,<\/span> item.<span class=\"me1\">info<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n<span class=\"kw1\">const<\/span> customShape <span class=\"sy0\">=<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ an appropriate data set<\/span><br \/>\n<span class=\"br0\">&#93;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\ndiagram.<span class=\"me1\">data<\/span>.<span class=\"me1\">parse<\/span><span class=\"br0\">&#40;<\/span>customShape<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/Custom-mind-map.gif\" alt=\"DHTMLX custom mind map\" width=\"900\" height=\"636\" class=\"aligncenter size-full wp-image-8411\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/diagram_template_b\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>This custom mind map is available as a CSS template in the DHTMLX collection of templates.<\/p>\n<h5>Mind Map Editor<\/h5>\n<p>Together with the introduction of a brand-new diagram type DHTMLX Diagram receives a new editor specifically designed for working with mind maps. The <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/#diagram-in-the-mindmap-mode\" rel=\"noopener\" target=\"_blank\">mind map editor<\/a> provides all the possibilities available in the diagram and org chart editors. It has two panels: one at the top and one to the right of the editing area.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/Mind-map-editor.gif\" alt=\"DHTMLX mind map editor\" width=\"900\" height=\"640\" class=\"aligncenter size-full wp-image-8413\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/lo1vm0e8\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>In order to create a mind map editor, you need to specify the editor type in the editor configuration object:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> editor <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">DiagramEditor<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span> <br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>A wide range of API properties enables you to configure the editor to meet your needs. You can manipulate editor controls and what&#8217;s more, customize the right panel to equip it with the necessary editing options. It may especially come in useful when you would like to edit a custom mind map like in the example below.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/Custom-mind-map-editor.gif\" alt=\"DHTMLX custom mind map editor\" width=\"900\" height=\"640\" class=\"aligncenter size-full wp-image-8412\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/do1jwmw1\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<h5>Custom Per-Shape Toolbar in Editors<\/h5>\n<p>Starting with v3.1, you can customize a per-shape toolbar in all DHTMLX Diagram editors. <\/p>\n<p>In the case of the mind map editor, the default toolbar consists of four controls for adding a new child shape, creating a new shape to the right of the root shape and to the left of the root shape, and removing a shape. <\/p>\n<p>To make customization possible, we have added the <strong>shapeToolbar<\/strong> configuration property, which allows manipulating toolbar controls and creating custom ones. If this property is specified to <em>true<\/em>, the toolbar will contain all the default controls specific to the editor you work with. To modify the toolbar, you can include only those controls that you need via the <strong>shapeToolbar<\/strong> property. The order in which you specify the controls determines how they are displayed in the toolbar. <\/p>\n<p>In the example below, we have left two controls in the toolbar: one for removing a shape and another for adding a shape.<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> editor <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">DiagramEditor<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; shapeToolbar<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><span class=\"st0\">&quot;remove&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;add&quot;<\/span><span class=\"br0\">&#93;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mindmap_toolbar_controls.png\" alt=\"DHTMLX mindmap toolbar\" width=\"369\" height=\"178\" class=\"aligncenter size-full wp-image-8415\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mindmap_toolbar_controls.png 369w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/mindmap_toolbar_controls-300x145.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/p>\n<p>You can not only fine-tune the toolbar by rearranging or disabling some controls but also add custom ones. The best way to add a custom control to the toolbar is to enable the default configuration of the toolbar by specifying the <strong>shapeToolbar<\/strong> property to <em>true<\/em> and to set an icon object in the <strong>shapeToolbar<\/strong> array. The icon object contains the id of the icon and the HTML content of the icon:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">const<\/span> editor <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">DiagramEditor<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;mindmap&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; shapeToolbar<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span> &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp;<span class=\"kw2\">true<\/span><span class=\"sy0\">,<\/span><br \/>\n<span class=\"br0\">&#123;<\/span> id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;download&quot;<\/span><span class=\"sy0\">,<\/span> content<span class=\"sy0\">:<\/span><span class=\"st0\">&quot;&lt;i class='dxi dxi-download'&gt;&lt;\/i&gt;&quot;<\/span> <span class=\"br0\">&#125;<\/span> &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#93;<\/span> <br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/fullcustom_toolbar_control.png\" alt=\"DHTMLX mindmap with custom toolbar\" width=\"360\" height=\"180\" class=\"aligncenter size-full wp-image-8416\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/fullcustom_toolbar_control.png 360w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/fullcustom_toolbar_control-300x150.png 300w\" sizes=\"auto, (max-width: 360px) 100vw, 360px\" \/><\/p>\n<p>Thus, v3.1 gives you full control over the configuration of a per-shape toolbar in all editors (<a href=\"https:\/\/docs.dhtmlx.com\/diagram\/guides\/diagram_editor\/initialization\/\" rel=\"noopener\" target=\"_blank\">diagram<\/a>, <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/#diagram-in-the-org-chart-mode\" rel=\"noopener\" target=\"_blank\">org chart<\/a>, and <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/#diagram-in-the-mindmap-mode\" rel=\"noopener\" target=\"_blank\">mind map<\/a>) and enables you to customize editors extensively.<\/p>\n<h5>Custom Event Handlers<\/h5>\n<p>From now on, DHTMLX Diagram is able to handle user interactions with custom shapes due to the ability to add custom event handlers. For that purpose, we have introduced the new <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/guides\/diagram\/configuration\/\" rel=\"noopener\" target=\"_blank\"><strong>eventHandlers<\/strong><\/a> attribute of the <strong>addShape()<\/strong> method.<\/p>\n<p>In the example below, we add an event handler to listen to the clicks on the icon with the <strong>info<\/strong> class, after which a modal window opens:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">diagram.<span class=\"me1\">addShape<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;template&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; template<span class=\"sy0\">:<\/span> template<span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; defaults<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; height<span class=\"sy0\">:<\/span> <span class=\"nu0\">190<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; width<span class=\"sy0\">:<\/span> <span class=\"nu0\">97<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; eventHandlers<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; onclick<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info<span class=\"sy0\">:<\/span> <span class=\"kw1\">function<\/span><span class=\"br0\">&#40;<\/span>event<span class=\"sy0\">,<\/span> item<span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; openModalInfo<span class=\"br0\">&#40;<\/span>item.<span class=\"me1\">title<\/span><span class=\"sy0\">,<\/span> item.<span class=\"me1\">info<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> <br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/04\/Open-modal.gif\" alt=\"DHTMLX custom events in mindmap\" width=\"900\" height=\"640\" class=\"aligncenter size-full wp-image-8417\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/do1jwmw1\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<h5>TypeScript Support<\/h5>\n<p>And the icing on the cake is <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/guides\/using_typescript\/\" rel=\"noopener\" target=\"_blank\">TypeScript support<\/a> provided by the DHTMLX Diagram library starting with v3.1. From now on, you can fall back on built-in type definitions and apply type suggestions, type checking, and autocompletion to speed up coding and make it clean and steady. <a href=\"https:\/\/snippet.dhtmlx.com\/ybpmz0zk\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<h5>Other Features and Updates<\/h5>\n<p>The release brings out new events of the editor object: <strong>BeforeShapeIconClick<\/strong> and <strong>AfterShapeIconClick<\/strong>, <strong>BeforeShapeMove<\/strong> and <strong>AfterShapeMove<\/strong>. They serve to track such user actions as clicking per-shape toolbar controls and moving shapes. Learn more in the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/api\/diagram_editor\/editor\/api_overview\/\" rel=\"noopener\" target=\"_blank\">Diagram Editor API reference<\/a>.<\/p>\n<p>V3.1 also delivers the ability to control the CSS styles of diagrams when they are exported via the export service. From now on, you can disable the <a href=\"https:\/\/docs.dhtmlx.com\/diagram\/api\/diagram\/exportstyles_property\/\" rel=\"noopener\" target=\"_blank\">export of CSS styles<\/a> or include only the styles you need to export them together with your diagram.<\/p>\n<p>We aspire to provide you with the complete toolkit for creating mind maps and customizing them to fit your requirements. Feel free to send us your feedback as well as your questions if any arise.<\/p>\n<p>We invite everyone to try out DHTMLX Diagram and mind mapping during a <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDiagram\/download.shtml\" rel=\"noopener\" target=\"_blank\">free 30-day trial period<\/a>. Current clients may download the latest version in their <a href=\"https:\/\/dhtmlx.com\/clients\/\" rel=\"noopener\" target=\"_blank\">Client&#8217;s Area<\/a>.<\/p>\n<p>Stay tuned!<\/p>\n<h5>Related Materials:<\/h5>\n<ul>\n<li><a href=\"https:\/\/docs.dhtmlx.com\/diagram\/whats_new\/\" rel=\"noopener\" target=\"_blank\">Full &#8220;What&#8217;s New&#8221; list<\/a><\/li>\n<li><a href=\"https:\/\/snippet.dhtmlx.com\/yfvccvc4?tag=diagram&#038;mode=wide\" rel=\"noopener\" target=\"_blank\">Samples<\/a><\/li>\n<li><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDiagram\/download.shtml\" rel=\"noopener\" target=\"_blank\">Free trial version<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>DHTMLX Diagram has been updated to version 3.1. We have incorporated plenty of feedback from the users of our JavaScript diagramming component into the release. Now you can create &#8230;<\/p>\n","protected":false},"author":101012,"featured_media":8401,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[33,58,41],"class_list":["post-8398","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-releases","tag-all-posts","tag-diagram","tag-typescript"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/users\/101012"}],"replies":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/comments?post=8398"}],"version-history":[{"count":32,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8398\/revisions"}],"predecessor-version":[{"id":14935,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8398\/revisions\/14935"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/8401"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=8398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=8398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=8398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}