Chartjs-How to resize chart.js graph dynamically for responsive sites?

2👍

You have given fixed min-height to the canvas div which restricts the chart to further change it’s dimensions. So, the following code has auto height and width automates to 100% which gives flexible chart.

#chartcontainer {
  position:relative;
  min-height:auto;
  width:100%;
  display: flex;
  flex-grow:1;
}

Leave a comment