chartjs : how to set custom scale in bar chart

后端 未结 3 1646
眼角桃花
眼角桃花 2020-12-31 07:47

Chartjs is a pretty excellent open source tool, but had a quick question about a bar chart I\'m trying to create. Given this chart data:

    var chartData =          


        
3条回答
  •  一生所求
    2020-12-31 08:26

    var myChart = new Chart(ctx, {
                    type: 'bar',
                    data:data,
                    options: {
                        responsive: true,
                        scales: {
                            yAxes: [{
                                ticks: {
                                    beginAtZero: true,
                                    steps: 10,
                                    stepValue: 6,
                                    max: 60 //max value for the chart is 60
                                    }
                                }
                            }]
                        }
                    }
                });
    

提交回复
热议问题