<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.1.2/chart.umd.js">
</script>
<title>GeeksforGeeks Bubble Chart - Example 2</title>
</head>
<body>
<div>
<h2 style="color:green">
GeeksforGeeks
</h2>
<h5>Chart JS Bubble Chart 2</h5>
<div>
<canvas id="bubbleChart2"
width="700"
height="300">
</canvas>
</div>
</div>
<script>
const data = {
datasets: [{
data: [
{ x: 15, y: 25, r: 18 },
{ x: 35, y: 45, r: 30 },
{ x: 55, y: 15, r: 25 },
],
backgroundColor: 'rgba(75, 192, 192, 0.6)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 2,
label: 'GeeksforGeeks Data',
hoverBackgroundColor: 'rgba(75, 192, 192, 0.8)',
hoverBorderColor: 'rgba(75, 192, 192, 1)',
hoverBorderWidth: 3,
pointStyle: 'triangle',
}],
};
const config = {
type: 'bubble',
data: data,
options: {
scales: {
x: { title: { display: true, text: 'X-Axis' } },
y: { title: { display: true, text: 'Y-Axis' } },
},
plugins: {
legend: { display: true, position: 'top' },
tooltip: { intersect: true },
},
},
};
const myBubbleChart =
new Chart(document.getElementById('bubbleChart2'), config);
</script>
</body>
</html>