Topic: Chart destroy method

neocheck 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


Kamila Pieńkowska 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 premium commented 2 years ago

Thank you for the workaround.


neocheck premium commented 2 years ago

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


Fleetenergies priority answered 1 year ago


URL not working please share working one


Kamila Pieńkowska staff commented 1 year ago

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


neocheck premium answered 2 years ago


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



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

  • ForumUser: Premium
  • 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