JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://d3js.org/d3.v3.js"></script>
<body>
</body>
CSS
.link {
stroke: #777;
stroke-width: 2px;
}
JavaScript
var color = ['#eff3ff', '#bdd7e7', '#6baed6','#3182bd','#08519c']
var scale = d3.scale.ordinal().domain([0,40]).range(color);
//Load in the json file
var data = {
"nodes":[
{"name":"sd"},
{"name":"sst"},
{"name":"saat"},
{"name":"ads"},
{"name":"asd"},
{"name":"zxct"},
{"name":"Jxzcct"},
{"name":"Mccct"},
{"name":"At"},
{"name":"Mfsfddf"}],
"links":[{"source":0, "target":1},
{"source":2, "target":3},
{"source":4, "target":5},
{"source":6, "target":7},
{"source":8, "target":9},
{"source":9, "target":1},
{"source":8, "target":7},
{"source":7, "target":4},
{"source":1, "target":6},
{"source":7, "target":2}
]};
var positions =
{"positions": [{"x":"-68.824367374", "y": "-6.10824525755"},
{"x":"-80.8080803911", "y": "-3.38997541264"},
{"x":"6.75334817585", "y": "-49.6040729697"},
{"x":"14.6608797291", "y": "-81.8897019921"},
{"x":"5.84422695973", "y": "-139.679889715"},
{"x":"9.4682879875", "y": "-135.716379506"},
{"x":"-85.094877309", "y": "8.75497395921"},
{"x":"-80.9245669198", "y": "5.12053025002"},
{"x":"33.3048781901", "y": "-44.8532425896"},
{"x":"76.292129562", "y": "-119.050611729"}
]};
var width = 300;
var height = 300;
var r = 5;
var posX = d3.scale.linear()
.range([0,width])
.domain([-125,120]);
var posY = d3.scale.linear()
.range([0,height])
.domain([-125,125]);
//Define force properties
//Force, nodes and links loaded in and force started
var force = d3.layout.force()
.charge(-100)
.linkDistance(3)
.size([width, height])
.nodes(data.nodes)
.links(data.links)
...