97 lines
3.0 KiB
HTML
97 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Bubble Chart with Chart.js</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
background-color: #f4f4f4;
|
|
}
|
|
#myChart {
|
|
max-width: 600px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="myChart"></canvas>
|
|
<script>
|
|
const ctx = document.getElementById('myChart').getContext('2d');
|
|
const data = {
|
|
datasets: [
|
|
{
|
|
label: 'Ramnit',
|
|
data: [{x: 1, y: 3, r: 10}],
|
|
backgroundColor: 'rgba(255, 99, 132, 0.6)',
|
|
borderColor: 'rgba(255, 99, 132, 1)',
|
|
borderWidth: 1,
|
|
},
|
|
{
|
|
label: 'Lollipop',
|
|
data: [{x: 2, y: 1, r: 20}],
|
|
backgroundColor: 'rgba(54, 162, 235, 0.6)',
|
|
borderColor: 'rgba(54, 162, 235, 1)',
|
|
borderWidth: 1,
|
|
},
|
|
{
|
|
label: 'Kelihos_ver3',
|
|
data: [{x: 3, y: 2, r: 15}],
|
|
backgroundColor: 'rgba(75, 192, 192, 0.6)',
|
|
borderColor: 'rgba(75, 192, 192, 1)',
|
|
borderWidth: 1,
|
|
},
|
|
// Add more datasets as needed
|
|
]
|
|
};
|
|
|
|
const config = {
|
|
type: 'bubble',
|
|
data: data,
|
|
options: {
|
|
scales: {
|
|
x: {
|
|
title: {
|
|
display: true,
|
|
text: 'Malware Class'
|
|
},
|
|
ticks: {
|
|
callback: function(value, index, values) {
|
|
const labels = ['Ramnit', 'Lollipop', 'Kelihos_ver3']; // Adjust this for all classes
|
|
return labels[index] || value;
|
|
}
|
|
}
|
|
},
|
|
y: {
|
|
title: {
|
|
display: true,
|
|
text: 'Y Axis'
|
|
},
|
|
beginAtZero: true
|
|
}
|
|
},
|
|
plugins: {
|
|
tooltip: {
|
|
callbacks: {
|
|
label: function(tooltipItem) {
|
|
return `${tooltipItem.dataset.label}: ${tooltipItem.raw.r}`;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
animation: {
|
|
duration: 1000,
|
|
easing: 'easeOutBounce',
|
|
}
|
|
}
|
|
};
|
|
|
|
const myChart = new Chart(ctx, config);
|
|
</script>
|
|
</body>
|
|
</html>
|