I'm trying to find out how to add border in chart area but it seems all I've been found is only applicable for datasets and the whole chart. Below code does not work.
Here is my code:
var myChart = new Chart(ctx, {
type: 'bar',
gridLines: {
borderWidth: {
top: 1,
right: 0,
bottom: 0,
left: 1
},
borderColor: '#6B7280',
},
}
(output wanted) add 5px green border around chart area except label
There is no default build in way to achieve this, if you want this you will have to write a custom plugin for it: https://www.chartjs.org/docs/latest/developers/plugins.html
you can wrap your canvas with a div tag and set border to it, if labels are out of it you can set padding-bottom & left to contains it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.