Chart.js canvas resize

前端 未结 13 1187
北海茫月
北海茫月 2020-11-30 23:39

In (Android WebView HTML5 canvas error) i posted a question regarding plotting graphs using Graph.js library. The problem i have now is that if i call the function to plot t

13条回答
  •  醉酒成梦
    2020-12-01 00:02

    I was having the same problem. I was able to solve it by setting option:

    responsive: false,
    maintainAspectRatio: true,
    showScale: false,

    And in css, set the width of the container div the same as the canvas:

        #canvasContainer { 
          width: 300px;
        }
        
        canvas {
          width: 300px;
        }

提交回复
热议问题