Charts.js graph not scaling to canvas size

后端 未结 11 1194
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 09:45

I\'m trying to make a graph with Charts.js (current one is just a really simple example I\'m trying to get working, somewhat taken from the Chart.js documentation) and the g

11条回答
  •  轮回少年
    2020-12-08 10:18

    1. Make a div element and place the chart canvas inside of it, name it as canvas-holder. See below:

       
    2. Using CSS, specify the height and width of the canvas holder

       #canvas-holder {
          background-color: #FFFFFF;
          position: absolute;
          width: 400px;
          height: 400px;
       }
      

提交回复
热议问题