destroy() {
    window.removeEventListener('resize', this.windowResizeHandler)

    removeResizeListener(this.el.parentNode, this.parentResizeHandler)
    // remove the chart's instance from the global Apex._chartInstances
    const chartID = this.w.config.chart.id
    if (chartID) {
      Apex._chartInstances.forEach((c, i) => {
        if (c.id === Utils.escapeString(chartID)) {
          Apex._chartInstances.splice(i, 1)
        }
      })
    }
    new Destroy(this.ctx).clear({ isUpdating: false })
  }
Destroy the chart instance by removing all elements which also clean up event listeners on those elements.