How to set max and min value for Y axis

后端 未结 17 2086
既然无缘
既然无缘 2020-11-27 11:08

I am using line chart from http://www.chartjs.org/ \"enter

As you can see max value (1

17条回答
  •  粉色の甜心
    2020-11-27 11:41

    window.onload = function(){
    var ctx = document.getElementById("canvas").getContext("2d");
    window.myLine = new Chart(ctx ,{
              type: 'line',
              data: yourData,
              options: {
                scales: {
                    yAxes: [{
                        ticks: {
                            beginAtZero:true,
                            min: 0,
                            max: 500    
                        }
                      }]
                   }
                }
    });
    

    I configure with 'options' in v2.

    You should read documentation: http://www.chartjs.org/docs/#scales-linear-scale

提交回复
热议问题