JSFiddle - React, Tailwind, and code Playground

by Oliver Houston

HTML

<script src="https://d3js.org/d3.v4.min.js"></script>

CSS

.links line {
  stroke: #999;
  stroke-opacity: 0.5;
}
.locLinks line {
  stroke: #999;
  stroke-opacity: 0.5;
}
.nodes circle {
  stroke: #000;
  stroke-width: 1px;
  stroke-opacity:0.5;
}
.locations circle {
	fill-opacity: 0.2;
	stroke: #000;
	stroke-width: 1px;
	}
.nodes .node-mouseover {
  cursor: pointer;
  stroke: #000;
  stroke-width: 1px;
}
.nodes .node-clicked {
  cursor: pointer;
  stroke: #000;
  stroke-width: 1px;
}
.tooltip {
  position:absolute;
  font: 14px sans-serif;
  background-color:#ccc;
  border: solid 1px #aaa;
  border-radius:3px;
  padding:5px;
}
.onpChart {
    display: inline-block;
    position: relative;
    width: 100%;
	height: 450px;
    padding-bottom: 0%; /* aspect ratio */
    vertical-align: top;
	overflow-y: hidden;
    overflow-x: scroll;
}
.svg-content-responsive {
    display: inline-block;
    position: absolute;
    top: 10px;
    left: 0;
}

JavaScript

var graph = {
"locations": [
{"id": "Cochlear",  "l_id": 1},
{"id": "Dorsal Cochlear Nucleus", "l_id": 2},
{"id": "Anteroventral Cochlear Nucleus", "l_id": 3},
{"id": "Posteroventral Cochlear Nucleus", "l_id": 4}
],
"cells": [
{"id": "Inner Hair Cell", "location": 1},
{"id": "Outer Hair Cell", "location": 1},
{"id": "Type I SGN", "location": 1},
{"id": "Type II SGN", "location": 1},
{"id": "Pyramidal", "location": 2},
{"id": "Stellate", "location": 2},
{"id": "Cartwheel", "location": 2},
{"id": "Unipolar Brush", "location": 2},
{"id": "Golgi", "location": 2},
{"id": "Granule", "location": 2},
{"id": "Giant", "location": 2},
{"id": "Tuberculoventral", "location": 2},
{"id": "Spherical", "location": 3},
{"id": "Globular", "location": 3},
{"id": "T-Stellate", "location": 3},
{"id": "D-Stellate", "location": 3},
{"id": "Planar","location": 4},
{"id": "Octopus","location": 4},
{"id": "Radiate","location": 4}
],
"locCell":[
{"source": "Inner Hair Cell", "target": "Cochlear"},
{"source": "Outer Hair Cell", "target": "Cochlear"},
{"source": "Type I SGN", "target": "Cochlear"},
{"source": "Type II SGN", "target": "Cochlear"},
{"source": "Pyramidal", "target": "Dorsal Cochlear Nucleus"},
{"source": "Stellate", "target": "Dorsal Cochlear Nucleus"},
{"source": "Cartwheel", "target": "Dorsal Cochlear Nucleus"},
{"source": "Unipolar Brush", "target": "Dorsal Cochlear Nucleus"},
{"source": "Golgi", "target": "Dorsal Cochlear Nucleus"},
{"source": "Granule", "target": "Dorsal Cochlear Nucleus"},
{"source": "Giant", "target": "Dorsal Cochlear Nucleus"},
{"source": "Tuberculoventral", "target": "Dorsal Cochlear Nucleus"},
{"source": "Spherical", "target": "Anteroventral Cochlear Nucleus"},
{"source": "Globular", "target": "Anteroventral Cochlear Nucleus"},
{"source": "T-Stellate", "target": "Anteroventral Cochlear Nucleus"},
{"source": "D-Stellate", "target": "Anteroventral Cochlear Nucleus"},
{"source": "Planar","target": "Posteroventral Cochlear Nucleus"},
{"source":...