Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/apexcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,9 @@ export default class ApexCharts {
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)
}
})
}

this._removeOldChartInstance()

new Destroy(this.ctx).clear({ isUpdating: false })
}

Expand Down Expand Up @@ -545,6 +539,8 @@ export default class ApexCharts {
return resolve(this)
}

this._removeOldChartInstance()

this.lastUpdateOptions = Utils.clone(options)

new Destroy(this.ctx).clear({ isUpdating: true })
Expand Down Expand Up @@ -795,7 +791,19 @@ export default class ApexCharts {
this._windowResize()
}
}

/**
* Remove the chart's old instance from the global Apex._chartInstances
*/
_removeOldChartInstance() {
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)
}
})
}
}
/**
* Handle window resize and re-draw the whole chart.
*/
Expand Down
Loading