I'm currently working on a project using charts.js and running into a slight issue. The legend for my bar chart is overlapping with the values displayed.
I've been attempting to troubleshoot this problem without much success so far, so I would greatly appreciate any solutions or suggestions you may have.
To provide more context, here is a link to the JS fiddle where I've shared the code: https://jsfiddle.net/qh0yzmjf/1/
var ctx = document.getElementById("canvas").getContext("2d");
var labels = [2017, 2018, 2019];
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [
{
label: 'PP PERVENUTI',
data: [50, 30, 45],
backgroundColor: "#8A0808",
fill: false,
borderColor: "#8A0808",
borderWidth: 3
},
// More dataset objects follow...
]
},
options: {
legend: {
display: true,
position: "top"
},
hover: {
animationDuration: 0
},
// Additional configuration settings...
}
});
Above, you can see a snippet of the code I'm working with.
I'm specifically struggling with creating space between the legend and the actual chart itself. Any assistance in resolving this issue would be highly appreciated. Thank you!