JSFiddle - React, Tailwind, and code Playground

by bizamajig

HTML

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

<p>Use the mouse to pan (click and move) / zoom (scrollwheel)</p>

CSS

body, html {
        width: 100%;
        height: 100%;
        margin: 0;
      }
      svg {
        position: absolute;
        top: 0;
        left: 0;
      }
      p {
        text-align: center;
      }

JavaScript

var svg = d3.select("body")
        .append("svg")
        .attr("width", "100%")
        .attr("height", "100%")
        .call(d3.zoom().on("zoom", function () {
            svg.attr("transform", 'translate('+d3.event.transform.x+',0) scale('+d3.event.transform.k+',1)')
        }))
        .append("g")

      svg.append("circle")
        .attr("cx", document.body.clientWidth / 2)
        .attr("cy", document.body.clientHeight / 2)
        .attr("r", 50)
        .style("fill", "#B8DEE6")