score:0

yes you can do something like that, you can transform the chart to an image and display that, then you can delete your chart which will free up the memory. downside of this will be that its not interactable anymore:

const options = {
  type: 'bar',
  data: {
    labels: ["red", "blue", "yellow", "green", "purple", "orange"],
    datasets: [{
        label: '# of votes',
        data: [12, 19, 3, 5, 2, 3],
        backgroundcolor: 'orange'
      },
      {
        label: '# of points',
        data: [7, 11, 5, 8, 3, 7],
        backgroundcolor: 'pink'
      }
    ]
  },
  options: {
    animation: false
  }
}

const ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
const chartcontainer = document.getelementbyid('chartjscontainer');
const chartimage = document.getelementbyid('chartimage');
const chart = new chart(ctx, options);
const base64chart = chart.tobase64image();

// set image source to chart image
chartimage.src = base64chart;

// destroy chart and remove canvas
chart.destroy();
chartcontainer.remove();
<body>
  <img id="chartimage">
  <canvas id="chartjscontainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js"></script>
</body>