How can i use width and height for PrimeNg Chart?
<p-chart type="bar" width="400" height="400" [data]="data"></p-chart>
There is no effect when i use width and height.Please let me know how to use Chart of width and height.
https://www.reddit.com/r/webdev/comments/4gjuvp/chartjs_canvas_height_width_ignored/
According to that link you have to set two options for the chart:
<p-chart type="bar" width="400" height="400" [data]="data" [options]="options"></p-chart>
And in your Typescript Code:
options = {
responsive: false,
maintainAspectRatio: false
};
Looking over the source code, p-chart takes width and height as component inputs, so putting them in [] should do the trick:
<p-chart type="bar" [width]="400" [height]="400" [data]="data"></p-chart>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With