[Chartjs]-How to set and adjust plots with equal axis aspect ratios – CHART.js

1👍

You can define the desired dimension of your canvas through the width or height property.

<canvas id="chartContainer" width="400"></canvas>

…or using CSS.

canvas {
  width: 400px;
}

Further you should also define responsive: false and aspectRatio: 1 within the chart options, latter represents a square canvas.

options: {
  responsive: false,
  aspectRatio: 1,

See Configuration Options at the Chart.js documentation

Leave a comment