Chartjs-Chart.js pie chart overflowing div

2👍

https://github.com/chartjs/Chart.js/issues/2422

Include a holder div and set maintainAspectRatio to false

<div id="canvas-holder" >
<canvas id="chart-canvase" />
</div>

var options = {
responsive: true,
maintainAspectRatio : false
};

-1👍

You need to wrap you chart into a div

#responsive-chart{
   height: 100%;
   width: 100%;
}

<div class="row">
    <div class="col-lg-1 m-b">
        <div id="new-old" class="statcard statcard-primary statcard-bg statcard-fixed-height-lg">
           <div class="p-a">
               <span class="statcard-desc">New vs. Returning Users</span>
                <div id="responsive-chart">
                    <canvas id="myPieChart"></canvas>
                </div>
           </div>
       </div>
    </div>
</div>

Leave a comment