<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Styled Line Chart</title>
<script src=
"https://cdn.jsdelivr.net/npm/chart.js">
</script>
<style>
/* Adding some basic styling to the body */
body {
font-family: 'Arial', sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
</style>
</head>
<body>
<canvas id="myChart"
width="600" height="200">
</canvas>
<script>
// Sample dataset
const data = {
labels: ['January',
'February',
'March',
'April',
'May',
'June',
'July'],
datasets: [{
label: 'Monthly Sales',
data: [12, 19, 3, 5, 2, 3, 9],
fill: false,
borderColor: 'green', // Border color
backgroundColor: 'green', // Background color for points
pointBorderColor: 'grren', // Border color for points
pointBackgroundColor: '#fff', // Fill color for points
pointBorderWidth: 2,
tension: 0.1 // Bezier curve tension
}]
};
// Chart configuration
const config = {
type: 'line',
data: data,
options: {
scales: {
y: {
beginAtZero: true
}
},
plugins: {
legend: {
labels: {
color: 'Green', // Color for labels
font: {
size: 14 // Font size
}
}
}
}
}
};
// Initializing the chart
new Chart(
document.getElementById('myChart'),
config
);
</script>
</body>
</html>