Chart.js line chart is cut off at the top?

前端 未结 7 1504
死守一世寂寞
死守一世寂寞 2020-12-16 19:27

For some reasone all graphs are cut off at the highest value. How can i fix this? I can\'t use a fixed y-axis

7条回答
  •  情话喂你
    2020-12-16 19:59

    The options.layout.padding.top solution didn't work for me (just added padding AFTER the line cut), so I extracted the high/low values from my data and used the suggestedMin and suggestedMax config params like this:

    var suggestedMin = {MIN};
    var suggestedMax = {MAX};
    
    options: {
        scales: {
            yAxes: [{
                ticks: {
                    suggestedMin: suggestedMin - 1,
                    suggestedMax: suggestedMax + 1,
                }
            }]
        }
    }
    

提交回复
热议问题