无法设置 canvas 高度 AngularJS
Unable to set canvas height AngularJS
所以我有一个 canvas 元素,我想使用 Angular 库绘制图表。我设法绘制了它,但问题是 canvas 元素不采用包含 div 的高度,它采用随机高度。以前有人遇到过这个问题吗?我还使用了 ChartJs 库 (http://www.chartjs.org/docs/) 中的 resize() 方法,但它似乎不起作用。有人有想法吗?
提前致谢!
尝试更改默认值。
// Boolean - whether or not the chart should be responsive and resize when the browser does.
responsive: true,
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
maintainAspectRatio: false
阅读更多信息:http://www.chartjs.org/docs/#chart-configuration-global-configuration
所以我有一个 canvas 元素,我想使用 Angular 库绘制图表。我设法绘制了它,但问题是 canvas 元素不采用包含 div 的高度,它采用随机高度。以前有人遇到过这个问题吗?我还使用了 ChartJs 库 (http://www.chartjs.org/docs/) 中的 resize() 方法,但它似乎不起作用。有人有想法吗?
提前致谢!
尝试更改默认值。
// Boolean - whether or not the chart should be responsive and resize when the browser does.
responsive: true,
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
maintainAspectRatio: false
阅读更多信息:http://www.chartjs.org/docs/#chart-configuration-global-configuration