How can I set the height of a chart with ng2-charts

BrandonReid picture BrandonReid · Jul 20, 2016 · Viewed 26.3k times · Source

How do I set a chart's height using ng2-charts? I'm making a line chart, just like the demo on the ng2-charts site.

I've searched the documentation for ng2-charts and chart.js. In chart.js it looks like you set a height property on the canvas element like <canvas height="400">, but that element is obscured by the ng2-charts component.

Answer

BrandonReid picture BrandonReid · Jul 21, 2016

Figured it out.

If responsive: true and maintainAspectRatio: false settings are set, you can then set the css height property of the <base-chart> element.