JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
JavaScript
var width = 0;
var height = 0;
$( document ).ready(function() {
width = $(document).width();
height = $(document).height();
var svg = d3.select("body")
.append("svg")
.attr("width", width)
.attr("height", height)
.call(d3.zoom().on("zoom", function () {
svg.attr("transform", d3.event.transform);
}))
.append("g");
var viewport = svg.append('g');
var x = d3.scaleLinear().range([width/2-5*width,width/2+5*width]).domain([-50, 50]); //not very elegant...
var y = d3.scaleLinear().range([height/2-5*height,height/2+3.244*width]).domain([50, -50]);
// Add the x Axis
svg.append("g")
.attr("transform", "translate(" + 0 + "," + height/2 + ")")
.call(d3.axisBottom(x).ticks(100));
// Add the y Axis
svg.append("g")
.attr("transform", "translate(" + width/2 + "," + 0 + ")")
.call(d3.axisLeft(y).ticks(100));
});