JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 100%;border: 1px solid black;"></div>
<button href="#" id="button">
Button
</button>
CSS
#button{
position: absolute;
}
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
data: [
{
type: "doughnut",
dataPoints: [
{ label: "apple", y: 18 },
{ label: "orange", y: 15 },
{ label: "banana", y: 25 },
{ label: "mango", y: 30 },
{ label: "grape", y: 28 }
]
}
]
});
chart.render();
var button = document.getElementById("button");
button.style.top = (chart.bounds.y2 - chart.bounds.y1)/2 + "px";
button.style.left = (chart.bounds.x2 - chart.bounds.x1)/2 - 20 + "px";