I've been working on customizing doughnut graphs with ChartJS and I'm struggling to create space between the graph and the legend.
Here's my legend configuration:
plugins: {
legend: {
display: true,
align: 'start',
position: 'bottom',
}
}
In an attempt to increase the height of the legend, I created this plugin:
const LegendMargin = {
id: 'LegendMargin',
beforeInit(chart, legend, options) {
const fitValue = chart.legend.fit;
chart.legend.fit = function fit() {
fitValue.bind(chart.legend)();
this.height += 40;
}
}
}
While this plugin successfully increased the height of the legend below the graph, the text within it remains aligned at the top of the box, which doesn't solve the issue.
Is there a way to align the text to the bottom of the box or add some margin/padding between the legend and the graph?
Thank you for any assistance!