Wednesday, February 1, 2017

Using the force directed graph with custom data

Using the code at: https://github.com/bshambaugh/mod-d3test-force-directed-4062045

replace miserables.json with:

{
  "nodes": [
    {"id": "a", "group": 1},
    {"id": "c", "group": 1},
    {"id": "d", "group": 1},
    {"id": "e", "group": 1},
    {"id": "q", "group": 1}
  ],
"links": [
    {"source": "d", "target": "q", "value": 1},
    {"source": "a", "target": "c", "value": 8},
    {"source": "c", "target": "d", "value": 10},
    {"source": "e", "target": "c", "value": 10},
    {"source": "c", "target": "q", "value": 10}
  ]
}

run the code and get:

see: https://github.com/bshambaugh/node-arc-d3/blob/master/js/tests/index.html for the implementation

No comments:

Post a Comment