Home forums Using CanvasJS Charts aren't full-size until page is refreshed Reply To: Charts aren't full-size until page is refreshed

#5273

syduck
Participant

pro-tip: if you load the charts when they are display:none, their size will be messed up (if you re-size the window it fixes it). If you have to load the chart when its display:none, you can explicitly add height and width in the init code (although percentage doesn’t work):


    var chart = new CanvasJS.Chart("chartContainer",
    {
      height: 550, //in pixels
      width: 600,
      title:{
      text: "Earthquakes - per month"
      },