How to set max and min value for Y axis

后端 未结 17 2078
既然无缘
既然无缘 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:19

    Since none of the suggestions above helped me with charts.js 2.1.4, I solved it by adding the value 0 to my data set array (but no extra label):

    statsData.push(0);
    
    [...]
    
    var myChart = new Chart(ctx, {
        type: 'horizontalBar',
        data: {
            datasets: [{
                data: statsData,
    [...]
    

提交回复
热议问题