UKUser35
UKUser35

Reputation: 163

Reduce size of chart within the canvas

I have done a lot of reading this afternoon about reducing the canvas size of chart.js charts and can see that it comes with issues. What I would like to know is whether its possible to reduce the size of the actual graph within the canvas? The size of the canvas isn't the problem as I have an aspectRatio of 1 which causes the (radar) chart to be square in aspect ratio. What I would like is to reduce the size of the chart to say 80% of its calculated size. Anyone know if this is possible? Am happy to hack the code as I've had to already for other features.

Upvotes: 0

Views: 271

Answers (1)

ɢʀᴜɴᴛ
ɢʀᴜɴᴛ

Reputation: 32859

Yes, that is possible.

You can set padding for your chart layout accordingly, which will decrease the actual chart size, like so :

layout: {
   padding: 20
}

set this inside your chart­'s options config.

Upvotes: 1

Related Questions