Ash
Ash

Reputation: 11

ChartJs - Adding padding after Y- Axis

I am using chart js 2.7 .I need to add padding after Y-Axis.Means i need a gap before the start and end of the graph. I need to bring the labels inside the x-axis line. I found a similar question below.

How to Add X axis Padding in chart js Line Graph

But it provides a solution by adding null values. Is there any other solution.

Thanks

Upvotes: 1

Views: 3890

Answers (1)

Kunal Khivensara
Kunal Khivensara

Reputation: 1669

Add to your options:

options: {
    scales: {
        yAxes: [{
            ticks: {
                padding: 100
            }
        }], 
    }
}

Working jsfiddle -> https://jsfiddle.net/vz4qhqpw/2664/

Upvotes: 2

Related Questions