Setting width and height

后端 未结 10 2084
广开言路
广开言路 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:36

    You can also simply surround the chart with container (according to official doc http://www.chartjs.org/docs/latest/general/responsive.html#important-note)

    CSS

    .chart-container {
        width: 1000px;
        height:600px
    }
    

    and with options

    responsive:true
    maintainAspectRatio: false
    

提交回复
热议问题