it seems like the width of the chart is limited to whatever the height of the div is, which for me is magically being set at about 300px by chartjs for some reason.

that's the default width of the canvas element (

this means that your responsive option is not actually doing what it's supposed to. the most likely reason is that the the wrapping element does not have a (measurable) size when the chart is being initialized. for angular, the most common reason is the wrapping (parent) elements not being in a fully rendered state when the chart is being initialized (eg. it has an ng-show or it's a hidden tab, etc.).

css on the parent element could also be a problem - e.g. the parent elements don't have a size (but looking at your markup this seems a bit unlikely)

note - even though you don't do a chart resize on window resize, chart.js automatically does it for all charts that are configured as responsive.


function initchart() {
    var canvas = document.getelementbyid('chart-canvas');
    canvas.width = parent.offsetwidth;
    canvas.height = parent.offsetwidth; ... 

+css parent block {
   width: 100%;
   min-height: 300px;

hope this will helps you.


if you want to make it responsive and preserve aspect ratio, 2 things to consider:

1) in options:

   responsive: true,
   maintainaspectratio: true, 

2) define the aspect ratio by setting width and height attributes to the canvas. in your case they're probably equal:

<canvas id="doughnut" 
    class="chart chart-doughnut">

Related Query

More Query from same tag