{"id":20821070,"url":"https://github.com/hubgit/d3-force","last_synced_at":"2025-07-03T02:36:50.814Z","repository":{"id":26654783,"uuid":"30111030","full_name":"hubgit/d3-force","owner":"hubgit","description":"Polymer web component for D3's force layout, with dynamic data loading","archived":false,"fork":false,"pushed_at":"2015-02-15T20:26:18.000Z","size":756,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-28T00:45:56.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://git.macropus.org/d3-force/components/d3-force/demo.html","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hubgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-31T11:59:56.000Z","updated_at":"2015-04-24T21:30:07.000Z","dependencies_parsed_at":"2022-06-30T00:02:18.853Z","dependency_job_id":null,"html_url":"https://github.com/hubgit/d3-force","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hubgit/d3-force","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubgit%2Fd3-force","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubgit%2Fd3-force/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubgit%2Fd3-force/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubgit%2Fd3-force/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hubgit","download_url":"https://codeload.github.com/hubgit/d3-force/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubgit%2Fd3-force/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263248528,"owners_count":23437038,"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":[],"created_at":"2024-11-17T22:11:15.355Z","updated_at":"2025-07-03T02:36:50.797Z","avatar_url":"https://github.com/hubgit.png","language":"CSS","readme":"# d3-force\n\n[Demo](http://git.macropus.org/d3-force/components/d3-force/demo.html)\n\n## Notes\n\n* The layout uses DOM nodes rather than SVG. This makes the node templates easier, but means that only the nodes are drawn, and not the links between them.\n* The nodes are positioned using CSS 3D transforms, so are composited using the GPU. This means that rendering the nodes takes a minimal amount of time - nearly all of the speed decrease as the graph gets larger is due to the graph layout calculation.\n* By over-riding the `graph.node` function, Polymer elements can be used as nodes: see [this demo](http://git.macropus.org/d3-force/components/d3-force/demo-polymer.html).\n\n## Nodes\n\n1. Every object must have an `id` (used to identify the object) and a `name` (for displaying the object).\n2. Each link must have a `source` and a `target` object.\n3. Links can be added to the graph by passing an array of links to `addLinks`, or by overriding the `expand` function and returning a Promise.\n4. Nodes are added to the graph automatically.\n\n## Getting started\n\n```bash\nbower install --save hubgit/d3-force\n```\n\n```html\n\u003clink rel=\"import\" href=\"bower_components/d3-force/d3-force.html\"\u003e\n\n\u003cd3-force\u003e\u003c/d3-force\u003e\n\n\u003cscript\u003e\nwindow.addEventListener('polymer-ready', function(e) {\n  var graph = document.querySelector('d3-force');\n\n  // when a node is clicked, add more links\n  graph.expand = function(source) {\n      return new Promise(function(respond, reject) {\n          var request = new XMLHttpRequest();\n          request.open('GET', source.href + '/related-artists');\n          request.responseType = 'json';\n          request.onload = function() {\n              respond(this.response.artists.map(function(artist) {\n                  return ({\n                      source: source,\n                      target: artist\n                  });\n              }));\n          };\n          request.send();\n      });\n  }\n\n  // start with a seed node\n  // every node must have an id and a name\n  graph.click({\n      id: '6WoTvA9qinpHtSRJuldYh6',\n      name: 'The Fall',\n      href: 'https://api.spotify.com/v1/artists/6WoTvA9qinpHtSRJuldYh6',\n      popularity: 52\n  });\n});\n\u003c/script\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubgit%2Fd3-force","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubgit%2Fd3-force","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubgit%2Fd3-force/lists"}