JSFiddle - React, Tailwind, and code Playground

by brigand

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script>
<div class="box">
  <div class="title">
    <span>Test</span>
  </div>
  <div class="content">
    <div id="div_g" class="graph"></div>
  </div>
</div>

CSS

.box * {
  user-select: none;
}

.title {
  flex: 0 0 auto;
}
.content {
  flex: 1 1 auto;
}

.box {
  display: flex;
  flex-direction: column;
  z-index: 2;
  background: #fffc;
  padding: 3px 3px 0px 3px;
  margin: 0;
  border-radius: 3px;
  width: 400px;
  height: 200px;
  resize: both;
  max-width: 100%;
  min-width: 200px;
  min-height: 100px;
  box-sizing: border-box;
  background: rgb(231, 231, 231);
}

.box::after {
  pointer-events: none;
  content: " ";
  font-size: 14px;
  position: absolute;
  height: 17px;
  width: 17px;
  text-align: center;
  bottom: 0px;
  right: 0px;
  border-style: solid;
  border-width: 0 0 16px 16px;
  border-color: transparent transparent #696969 transparent;
  z-index: 11;
}

.content {
  position: relative;
  overflow: hidden;
  z-index: 1;
  box-sizing: border-box;
}

.graph {
  z-index: 1;
  width: 100%;
  height: 100%;
}

JavaScript

var a = new Dygraph(document.getElementById("div_g"),
  [
    [1, 10],
    [2, 20],
    [3, 50],
    [4, 70]
  ], {
    labels: ["x", "A"],
    showRangeSelector: true,
  });

var ro = new ResizeObserver((entries) => {
  if (a) {
    a.resize();
  }
});

ro.observe(document.getElementById("div_g"));