<!DOCTYPE html>
<
html
>
<
head
>
<
title
>
Area Chart Example
</
title
>
<
script
src
=
</
script
>
<
script
src
=
</
script
>
</
head
>
<
body
>
<
h1
style
=
"color:green;"
>
GeeksforGeeks
</
h1
>
<
h3
>
Chart JS Area Chart Example 2
</
h3
>
<
canvas
id
=
"stackedArea"
width
=
"800"
height
=
"350"
>
</
canvas
>
<
script
>
var ctx =
document.getElementById('stackedArea').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['January',
'February',
'March',
'April',
'May'],
datasets: [
{
label: 'Page Views',
data: [5000, 7500, 4000, 6000, 2000],
backgroundColor: 'rgba(75, 192, 192, 0.5)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 2,
fill: true,
},
{
label: 'Unique Visitors',
data: [2500, 1000, 4000, 3000, 3500],
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 2,
fill: true,
},
{
label: 'Bounce Rate',
data: [10, 30, 5, 15, 20],
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 2,
fill: true,
}
]
},
options: {
scales: {
y: {
beginAtZero: true,
stacked: true,
title: {
display: true,
text: 'Statistics'
}
},
x: {
stacked: true
}
},
layout: {
padding: {
left: 20,
right: 20,
top: 20,
bottom: 20
}
},
plugins: {
legend: {
position: 'top',
},
}
}
});
</
script
>
</
body
>
</
html
>