Setting width and height

后端 未结 10 2063
广开言路
广开言路 2020-12-07 19:50

I\'m trying out the example code for Chart.js given in the docs.

Width and height is specified inline on the canvas element at 400px/400px.

But when renderin

10条回答
  •  不思量自难忘°
    2020-12-07 20:23

    You can override the canvas style width !important ...

    canvas{
    
      width:1000px !important;
      height:600px !important;
    
    }
    

    also

    specify responsive:true, property under options..

    options: {
        responsive: true,
        maintainAspectRatio: false,
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero:true
                }
            }]
        }
    }
    

    update under options added : maintainAspectRatio: false,

    link : http://codepen.io/theConstructor/pen/KMpqvo

提交回复
热议问题