├── .gitattributes ├── .gitignore ├── .pre-commit-config.yaml ├── .prettierrc.js ├── .tool-versions ├── CHANGELOG.md ├── LICENSE ├── README.md ├── commitlint.config.js ├── eslint.config.mjs ├── example ├── clos.html ├── clos.json ├── images │ ├── bundle01.png │ ├── bundle02.png │ ├── clos.png │ ├── group_size.png │ ├── internal_group.png │ ├── ix.png │ ├── link_label.png │ ├── link_width.png │ ├── nat.png │ ├── node_label.png │ ├── node_size.png │ ├── openflow.png │ ├── position_hints.png │ ├── router.png │ ├── shownet.png │ ├── switch.png │ └── tooltip.png ├── index.html ├── index.json ├── shownet.html ├── shownet.json └── style.css ├── inet-henge.js ├── inet-henge.js.map ├── inet-henge.min.js ├── inet-henge.min.js.LICENSE.txt ├── inet-henge.min.js.map ├── package-lock.json ├── package.json ├── plugins ├── arrows_link │ ├── README.md │ ├── docs │ │ └── images │ │ │ └── screenshot01.png │ ├── plugin.js │ ├── plugin.js.map │ ├── plugin.min.js │ ├── plugin.min.js.map │ ├── src │ │ └── plugin.ts │ ├── style.css │ ├── tsconfig.json │ ├── webpack.common.js │ ├── webpack.dev.js │ └── webpack.prod.js └── removable_node │ ├── README.md │ ├── docs │ └── images │ │ └── screenshot01.gif │ ├── plugin.js │ ├── plugin.js.map │ ├── plugin.min.js │ ├── plugin.min.js.map │ ├── src │ └── plugin.ts │ ├── tsconfig.json │ ├── webpack.common.js │ ├── webpack.dev.js │ └── webpack.prod.js ├── src ├── bundle.ts ├── diagram.ts ├── group.ts ├── hack_cola.js ├── link.ts ├── link_tooltip.ts ├── meta_data.ts ├── node.ts ├── node_tooltip.ts ├── plugin.ts ├── position_cache.ts ├── tooltip.ts └── util.ts ├── tsconfig.json ├── types └── WebCola.d.ts ├── vendor ├── cola.min.js └── cola.min.js.map ├── webpack.common.js ├── webpack.dev.js └── webpack.prod.js /.gitattributes: -------------------------------------------------------------------------------- 1 | /inet-henge.* diff=skip 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | /WebCola/ 4 | /.idea/ 5 | /bak/ 6 | .ignore 7 | tags 8 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook 3 | rev: v9.13.0 4 | hooks: 5 | - id: commitlint 6 | stages: [commit-msg] 7 | additional_dependencies: ["@commitlint/config-conventional"] 8 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | semi: true, 3 | trailingComma: "all", 4 | singleQuote: false, 5 | printWidth: 120, 6 | tabWidth: 2, 7 | useTabs: false, 8 | }; 9 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 20.17.0 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.4.7] - 2024-08-23 2 | 3 | ### Fixed 4 | 5 | - Link.tick() unexpectedly threw TypeError 6 | 7 | 8 | ## [1.4.6] - 2024-08-18 9 | 10 | ### Fixed 11 | 12 | - Hide link labels when the link having them is too short. 13 | Otherwise, Chrome ( and Edge ) show them at unexpected positions. 14 | 15 | 16 | ## [1.4.4] - 2024-03-09 17 | 18 | ### Fixed 19 | 20 | - Source node was shown in "target" field of LinkTooltip 21 | 22 | 23 | ## [1.4.3] - 2023-09-24 24 | 25 | ### Fixed 26 | 27 | - Define Diagram.tickCallback to call in custom "tick" event listener 28 | 29 | 30 | ## [1.4.2] - 2023-08-21 31 | 32 | ### Fixed 33 | 34 | - Link tooltips not following 35 | 36 | 37 | ## [1.4.1] - 2023-08-20 38 | 39 | ### Fixed 40 | 41 | - Tooltips not following dragged group 42 | 43 | 44 | ## [1.4.0] - 2023-08-16 45 | 46 | ### Added 47 | 48 | - "bundle" option of link to show bundle "tie" marks over bundled links 49 | - "positionConstraints" option of Diagram 50 | - Link tooltip 51 | 52 | 53 | ## [1.3.1] - 2023-06-10 54 | 55 | ### Fixed 56 | 57 | - Zoom origin when initial translate is specified 58 | 59 | 60 | ## [1.3.0] - 2023-04-12 61 | 62 | ### Added 63 | 64 | - Introduce "nodeCallback" option for position hinting 65 | 66 | 67 | ## [1.2.5] - 2022-12-11 68 | 69 | ### Added 70 | 71 | - Introduce "groupPadding" option to increase the size of groups 72 | 73 | 74 | ## [1.2.4] - 2022-12-01 75 | 76 | ### Fixed 77 | 78 | - Tooltip visibility control along with Bootstrap CSS 79 | 80 | 81 | ## [1.2.2] - 2022-09-26 82 | 83 | ### Added 84 | 85 | - Introduce "nodeWidth" and "nodeHeight" options of `Diagram` 86 | 87 | 88 | ## [1.2.1] - 2022-03-09 89 | 90 | ### Added 91 | 92 | - Introduce "href" option to show `` in tooltips 93 | 94 | 95 | ## [1.2.0] - 2021-09-27 96 | 97 | ### Added 98 | 99 | - Introduce plugin system. 100 | - Removable Node Plugin 101 | - Arrows Link Plugin 102 | 103 | ### Fixed 104 | 105 | - Use md5 instead of sha1 for positionCache hash. Bundling crypto results in an unexpectedly huge bundle size. 106 | 107 | ### Removed 108 | 109 | - Remove a deprecated method `Diagram.prototype.link_width`. 110 | 111 | 112 | ## [1.1.1] - 2021-02-01 113 | 114 | ### Fixed 115 | 116 | - CSS escape to avoid "Uncaught DOMException: Failed to execute 'querySelector' on 'Document'" 117 | 118 | 119 | ## [1.1.0] - 2020-11-09 120 | 121 | ### Added 122 | 123 | - Introduce "initialTicks" option for unconstrained initial layout iterations. 124 | 125 | 126 | ## [1.0.2] - 2020-06-29 127 | 128 | ### Added 129 | 130 | - Create an npm package of inet-henge so that users can use it in other projects, even customize and rebuild. 131 | - Rewrote all .js with .ts to reuse in typescript projects. 132 | - Update the build environment, which was .js + babel + browserify, with .ts + webpack + ts-loader. 133 | 134 | 135 | ## [1.0.0] - 2020-02-25 136 | 137 | ### Added 138 | 139 | - Start versioning. 140 | 141 | ### Fixed 142 | 143 | - Change SVG DOM structure to render link labels in front of nodes. 144 | - :warning: This change breaks backward compatibility in CSS. Use `.link line` instead of `.link`, `.link text` instead of `.path-label`, and `.link text.hover` instead of `.link:hover ~ .path-label ` for instance. 145 | 146 | #### Previous SVG DOM 147 | 148 | ```svg 149 | 187 | ``` 188 | 189 | #### v1.0.0's SVG DOM 190 | 191 | ```svg 192 | 248 | ``` 249 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2024 Shintaro Kojima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # inet-henge.js 2 | 3 | inet-henge.js generates d3.js based Auto Layout Network Diagram from JSON data. 4 | inet-henge helps you draw it by calculating coordinates automatically, placing nodes and links in SVG format. 5 | 6 | Each object is draggable and zoomable. 7 | 8 |  9 | 10 | All you have to do are: 11 | 12 | 1. Define nodes identified by name 13 | 2. Define links by specifying both end nodes 14 | 3. Show in a browser. That's it. 15 | 16 | JSON example: 17 | 18 | ```json 19 | { 20 | "nodes": [ 21 | { "name": "A" }, 22 | { "name": "B" } 23 | ], 24 | 25 | "links": [ 26 | { "source": "A", "target": "B" } 27 | ] 28 | } 29 | ``` 30 | 31 | ## Getting Started 32 | 33 | ```zsh 34 | npm install inet-henge 35 | 36 | # or 37 | 38 | git clone https://github.com/codeout/inet-henge.git 39 | ``` 40 | 41 | Then host the root directory in your favorite web server. 42 | 43 | ``` 44 | ruby -run -e httpd . -p 8000 45 | ``` 46 | 47 | Now you can see `http://localhost:8000/example`. 48 | 49 | ``` 50 | python -m SimpleHTTPServer # python2 51 | python -m http.server # python3 52 | 53 | or 54 | 55 | php -S 127.0.0.1:8000 56 | ``` 57 | 58 | are also available to start a web server. 59 | 60 | ## Demo 61 | 62 | - [Shownet 2017 Network](https://codeout.github.io/inet-henge/shownet2017.html) 63 | - [Shownet 2016 Network](https://codeout.github.io/inet-henge/shownet2016.html) 64 | 65 | ## Usage 66 | 67 | In example [here](example/shownet.html), load related assets at first: 68 | 69 | - d3.js v3 70 | - cola.js 71 | - :warning: **It doesn't support d3.js v4** :warning: 72 | - inet-henge.js 73 | 74 | ```html 75 | 76 | 77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | ``` 88 | 89 | define a blank container: 90 | 91 | ```html 92 | 93 | 94 | 95 | ``` 96 | 97 | and render your network diagram: 98 | 99 | ```html 100 | 103 | 104 | ``` 105 | 106 | Object is also acceptable: 107 | 108 | ```html 109 | 116 |