{"id":19210814,"url":"https://github.com/flekschas/d3-list-graph","last_synced_at":"2025-05-12T19:25:58.917Z","repository":{"id":41077778,"uuid":"45867525","full_name":"flekschas/d3-list-graph","owner":"flekschas","description":"D3 layout for a graph composed of adjacent lists of nodes","archived":false,"fork":false,"pushed_at":"2021-09-07T22:48:14.000Z","size":3208,"stargazers_count":17,"open_issues_count":10,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T17:37:37.177Z","etag":null,"topics":["d3","es6","graph","list","svg","visualization"],"latest_commit_sha":null,"homepage":"https://flekschas.github.io/d3-list-graph/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flekschas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":null,"security":null,"support":null}},"created_at":"2015-11-09T21:21:04.000Z","updated_at":"2022-07-21T18:35:31.000Z","dependencies_parsed_at":"2022-09-01T13:12:46.750Z","dependency_job_id":null,"html_url":"https://github.com/flekschas/d3-list-graph","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flekschas%2Fd3-list-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flekschas%2Fd3-list-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flekschas%2Fd3-list-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flekschas%2Fd3-list-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flekschas","download_url":"https://codeload.github.com/flekschas/d3-list-graph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253807113,"owners_count":21967299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d3","es6","graph","list","svg","visualization"],"created_at":"2024-11-09T13:38:08.064Z","updated_at":"2025-05-12T19:25:58.891Z","avatar_url":"https://github.com/flekschas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D3 List Graph [![Build Status](https://travis-ci.org/flekschas/d3-list-graph.svg?branch=master)](https://travis-ci.org/flekschas/d3-list-graph)\n\n\u003e A flat horizontal scrollable node-link diagram, implemented in ES6 and orchestrated by D3 **v4**.\n\n![Teaser Image](teaser.png)\n\n**Demo**: https://flekschas.github.io/d3-list-graph/\n\n**Background Information / Application**: [SATORI](http://satori.lekschas.de)\n\n**Note**: Starting from version **0.17.0**, D3.js **v3.x** is no longer supported. Please use D3.js **v4.x** instead. If you need to both version please [see here](#migration-d3js-v3-to-v4).\n\n## Install\n\n```shell\nbower install flekschas/d3-list-graph --save\n```\n\n## Dependencies\n\nThis visualization depends on the following libraries to be available globally:\n\n- D3 **v4**\n- jQuery\n- jQuery's Mousewheel Plugin\n\n## Usage\n\nThis example assumes that you're using Bower to fetch all code.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003ctitle\u003eExample\u003c/title\u003e\n  \u003clink href=\"bower_components/d3-list-graph/dist/listGraph.css\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv class=\"list-graph\"\u003e\n    \u003cdiv class=\"top-bar\"\u003e\u003c/div\u003e\n    \u003cdiv class=\"wrapper\"\u003e\u003csvg class=\"base\"\u003e\u003c/svg\u003e\u003c/div\u003e\n  \u003c/div\u003e\n  \u003cscript src=\"bower_components/jquery/dist/jquery.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/jquery-mousewheel/jquery.mousewheel.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/d3/d3.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/d3-list-graph/dist/d3.listGraph.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/d3-list-graph/dist/listGraph.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    d3.json('bower_components/d3-list-graph/example/data.json', function (error, data) {\n      if (error) throw error;\n\n      var graph = new ListGraph({\n        data: data,\n        element: document.querySelector('.list-graph'),\n        rootNodes: [1, 2]\n      });\n    });\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Migration from D3.js v3 to v4\n\nStarting from version **0.17.0**, D3.js **v3.x** is no longer supported. If you still need to run old code on D3.js v4 please stick to the following pattern to load both versions but use v4 for the tree graph.\n\n**Note:** D3.js v4 does not actually create a new object and overwrite the global `d3` object because it embraces extensibility and modularization. Therefore, you have to load D3.js v4 **first**, reassign the variable, and then overwrite it with D3.js v3.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003ctitle\u003eExample\u003c/title\u003e\n  \u003clink href=\"bower_components/d3-list-graph/dist/listGraph.css\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv class=\"list-graph\"\u003e\n    \u003cdiv class=\"top-bar\"\u003e\u003c/div\u003e\n    \u003cdiv class=\"wrapper\"\u003e\u003csvg class=\"base\"\u003e\u003c/svg\u003e\u003c/div\u003e\n  \u003c/div\u003e\n  \u003cscript src=\"bower_components/jquery/dist/jquery.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/jquery-mousewheel/jquery.mousewheel.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"https://d3js.org/d3.v4.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/d3-list-graph/dist/d3.listGraph.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"bower_components/d3-list-graph/dist/listGraph.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003evar d3V4 = d3;\u003c/script\u003e\n  \u003cscript src=\"https://d3js.org/d3.v3.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    d3.json('bower_components/d3-list-graph/example/data.json', function (error, data) {\n      if (error) throw error;\n\n      var graph = new ListGraph({\n        d3: d3V4,\n        data: data,\n        element: document.querySelector('.list-graph'),\n        rootNodes: [1, 2]\n      });\n    });\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nMake sure to load D3.js v4, the list graph layout, the list graph app, and all other version 4 related code first. Then reassign the global variable `d3` to `d3V4` (or whatever you like to call it). Finally, specify the version 4 of D3 when loading the list graph by püassing a property called `d3` and assign `d3V4` to it. When that property is unassigned the tool will use the globally available `d3` variable and complain if the version doesn't match `4.x.y`.\n\n### Parameters\n\n#### Required parameters:\n\n**element**: _Object_.\nDOM element that should act as the base element.\n\n**data**: _Object_.\nUnique key-value list-like object. E.g.: `{1: {...}, 2: {...}, 3: {...}}`.\n\n**rootNodes**: _Array_.\nList of node ids that should act as root nodes.\n\n---\n\n#### Optional parameters:\n\n**d3**: _Object_.\nD3 library. Useful when working with two different version of D3 on the same page.\n\n**width**: _Number_ [100% of the SVG container].\nNumber of columns to be shown.\n\n**height**: _Number_ [100% of the SVG container].\nNumber of columns to be shown.\n\n**scrollbarWidth**: _Number_ [`6`].\nWidth of the scrollbars.\n\n**columns**: _Number_ [`5`].\nNumber of columns to be shown.\n\n**rows**: _Number_ [`5`].\nNumber of rows to be shown.\n\n**iconPath**: _String_ [_Empty string_].\nPath to an SVG icon file. Default is an empty string, which is equivalent to inline SVG, meaning that the ListGraphs internal icons are used.\n\n**barMode**: _String_ [`one`].\nInitial bar mode. Can either be `one` or `two`.\n\n**highlightActiveLevel**: _Boolean_ [`false`].\nIf `true` the currently active root level is highlighted\n\n**activeLevel**: _Number_ [`0`].\nOffset of the root level to be highlighted. If `1` one level to the right of the root level will be highlighted.\n\n**noRootActiveLevelDiff**: _Number_ [`0`].\nNegative offset when no manually selected new root level is set.\n\n**forceWidth**: _Boolean_ [`false`].\nIf you want to force the visualization to be of a certain width use this. [Default: false]\n\n**sortBy**: _String_.\nInitial sorting of a property. This string should be identical to the property key.\n\n**sortOrder:** _String_ [`desc`].\nInitial sort order. Can either be `asc` or `desc`.\n\n**dispatcher**: _Function_.\nCan be used to listen to internal events.\n\n**lessTransitions**: _Number_ [`0`].\n- 0 [Default]: Show all transitions\n- 1: Show only CSS transitions\n- 2: Show no transitions\n\n**hideOutwardsLinks**: _Boolean_ [`false`].\nIf `true` links that point to invisible nodes will not be shown.\n\n**nodeInfoContextMenu**: _Array_ [`[]`].\nAn array of objects specifying which node properties the _node context menu_ should be displayed. E.g. `[{ label: 'ID', property: function (data) { return data.id } }]`.\n\n**customTopbarButtons**: _Array_ [`[]`].\nAn array of objects specifying custom buttons in the topbar. E.g. `[{ label: 'Click me', callback: function () { ... }, iconSvg: 'path/to/icon.svg#icon-name' }, iconSpan: 'span class names']`.\n\n## Develop\n\nTo preview the toy development example website do:\n\n```shell\nnpm start\n```\n\nIn order to build a final production ready library run:\n\n```shell\nnpm run build\n```\n\n**Note:** You can also pass `--production` to `gulp` in order to test if the\ncompiled version really works. Note that you have to change the paths in\n`example/index.html`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflekschas%2Fd3-list-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflekschas%2Fd3-list-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflekschas%2Fd3-list-graph/lists"}