score:13
Accepted answer
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
};
score:7
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>
Source: stackoverflow.com
Related Query
- How to use PrimeNg Chart of Width and Height?
- How to get the actual chart width and height in chart.js
- Chart.js: width and height of a pie chart not respected
- React chart : prevent chart's canvas scaling with height and width
- Why would a ChartJS chart end up with width 0 and height 0?
- How to style a pie chart in chart js? I want to change the border color, border width and give them shadow
- how can i use chart.js to create a chart that has one time series line and one linear line on it at the same time?
- Unable to set width and height on canvas in chart js
- how to reduce list chart to one and use select dropdown to show selection without refresh page?
- How to set responsive width and height of canvas?
- How to use forEach loop on my array to plot x and y variables on my chart (Chart.js)
- How to use plugins in chartjs and laravel chart consoletvs/chartsjs
- attempting to change height and width of canvas for chart
- How to shrink the height and increase the line width of a custom Chartjs horizontal line?
- Prevent size of canvas chart js to equal window height and width
- How to control width of chart using angular-chart and chart.js?
- Setting width and height
- chart js 2 how to set bar width
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to add second Y-axis for Bar and Line chart in Chart.js?
- Changing width and height in angular-chart.js module
- Resize the width and height of the ng2-charts
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- Chart js: how can I align the legend and the title
- PrimeNg bar chart how to show a label for the y-axis
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How to dynamically set ChartJs line chart width based on dataset size?
- How to show data values in top of bar chart and line chart in chart.js 3
- How to draw a needle on a custom donut chart and add datapoints to the needle?
More Query from same tag
- Chart.JS - Couldn't add the margin/spacing between Y-axis labels
- (Chart.js 3.7.0) change position of x-axis ticks to alternate between each tick?
- getting additional value fields from data source for dx.chartjs doughnut chart
- Chart.js color change of the data points
- How to add text inside the doughnut chart using Chart.js AngularJS 2.0?
- How to create dynamic D3 tickFormat in dc charts
- Html chart does not fit a small Android WebView
- chart.js streaming data plugin data format or config error
- Chartjs: old data being displayed
- How to fill background colors on line-charts?
- Chartjs doc examples are lightning fast but same code is slow when reproducing
- warning in chartjs/react-chartjs options assignment if setting type:'time'
- How to register plot or label click event in chart.js
- nodejs express jade mongodb project: how to import include chart.js
- Chartjs: I only want left and right padding in pie chart
- How do I add different data in my new chart?
- Last 24 Hours Data Report Show In Chart.Js
- 0 line style of Chart.js line chart
- How can I move chartJs legend left side and change the width and Hight of the chart?
- Is it possible to reverse the display order of segments in polar chart?
- chartJs: I want to show both of the dataset legends when i hover to one of the points?
- react-chartjs-2 with chartJs 3: Error "arc" is not a registered element
- Foreground chart by mouse
- core.js:4197 ERROR TypeError: chart_js__WEBPACK_IMPORTED_MODULE_2__ is not a constructor
- Problem in making chart with Chart.js in wix?
- How to add an extra tick on top of the highest bar in Chart.js v2.9.4 (grace)?
- Chart.js Formatting dual axis and labels
- How to show data values in top of bar chart and line chart in chart.js 3
- add shadow for line in vue chartjs
- how get data from given string in javascript?