score:2

bit late but i had the same problem. to fix it you need to get your chart to generate from window.onload.

e.g.

window.onload = function() {
  var ctx = document.getelementbyid('mychart').getcontext('2d');
  window.myline = new chart(ctx, {
      type: 'line',
      data: {
          labels: ["2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017"],
          datasets: [{
              label: 'udvikling i motorvejstrafikken 2010-2017',
              data: [100, 103.5, 107.2, 110.3, 115.4, 120.9, 126.3, 131.5],
              backgroundcolor: [
                  'rgba(255, 99, 132, 0.2)',
                  'rgba(54, 162, 235, 0.2)',
                  'rgba(255, 206, 86, 0.2)',
                  'rgba(75, 192, 192, 0.2)',
                  'rgba(153, 102, 255, 0.2)',
                  'rgba(255, 159, 64, 0.2)'
              ],
              bordercolor: [
                  'rgba(255,99,132,1)',
                  'rgba(54, 162, 235, 1)',
                  'rgba(255, 206, 86, 1)',
                  'rgba(75, 192, 192, 1)',
                  'rgba(153, 102, 255, 1)',
                  'rgba(255, 159, 64, 1)'
              ],
              borderwidth: 4
          }]
      },
      options: {
          scales: {
              yaxes: [{
                  ticks: {
                      min: 90
                  }
              }]
          }
      }
  });
};

don't know why it works locally without this, but needed this change to display on the server.


Related Query

More Query from same tag