Chartjs-How to set responsive width and height of canvas?

0👍

Add a div around your chartjs or canvas:

<div class="chart-wrapper">
    <canvas id="mychart" "width="600" height="250"></canvas>
</div>

Add height to the wrapper, and adjust it according to responsive redering

.chart-wrapper {
height: 300px !important;
}

Leave a comment