Chart destroy method


Topic: Chart destroy method

neocheck pro premium asked 2 years ago

Although the chart documentation says that dispose function removes the chart instance, it is not possible to create a new chart on the same canvas after calling the dispose method. The JavaScript error indicates that the chart must be destroyed before it can be reused. This is only possible with the destroy method from chartjs....

The destroy function is not available in MDB.

JavaScript error calling new mdb.Chart(...) after chartInstance.dispose():

Uncaught Error: Canvas is already in use. Chart with ID '0' must be destroyed before the canvas with ID 'DocumentCheckTransactionsChart' can be reused.

JavaScript error calling new chart.destroy() or chartInstance.destroy():

Uncaught TypeError: chart[0].destroy is not a function


kpienkowska staff answered 2 years ago

We are aware of that bug. We are working on the fix.

Until then please destroy the chart before dispose. Example of how to do that: https://mdbootstrap.com/snippets/standard/kpienkowska/4434713


neocheck pro premium commented 2 years ago

Thank you for the workaround.


neocheck pro premium commented 2 years ago

Is this bug fixed in the new MDB update? Thank you.


neocheck pro premium answered 2 years ago

Is this bug fixed in the new MDB update 6.0.0? Thank you.


Fleetenergies pro premium priority answered a year ago

URL not working please share working one


kpienkowska staff commented a year ago

I've prepared a new snippet: https://mdbootstrap.com/snippets/standard/kpienkowska/4886342


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No