var chart = bb.generate({
bindto: "#chart",
data: {
columns: [
["data1", 130, 200, 100, 170, 150, 250],
["data2", 130, 100, 140, 35, 110, 50]
],
types: {
data1: "line",
data2: "area-spline"
},
colors: {
data1: "red",
data2: "green"
}
}
});
setTimeout(() => {
const containerW = $("#chart").width();
const svgW = $("#chart svg").width();
console.log(`div width - ${containerW}`);
console.log(`SVG width - ${svgW}`);
});
#chart {
width: 501px;
height: 201px;
border: 1px solid green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/billboard.js/dist/billboard.min.css" />
<script src="https://cdn.jsdelivr.net/npm/billboard.js/dist/billboard.pkgd.min.js"></script>
<title>JS Bin</title>
</head>
<body>
<div id="chart"></div>
</body>
</html>