Chart dispose reset the container div to incorrect status

Posted by: Yifan_Zhang on 24 October 2020, 5:02 pm EST

  • Posted 24 October 2020, 5:02 pm EST

    See the example here: https://jsfiddle.net/1of76ks3/1/

    After clicking the resize, dispose in order, and then click recreate, the chart is reset back to use the old div not the resized one. This is really messed up when the div width and height is calculated based on certain layout. Could you please fix this?

  • Posted 24 October 2020, 5:07 pm EST

    When chart is disposed, it should not reset back everything for the parent container.

  • Posted 26 October 2020, 4:43 am EST

    Hi Yifan,

    When a wijmo control is initialized it saves the outer HTML of the host element and then restores it when disposed. That is why the size is returned to the original size. To keep the updated size after disposing I would suggest you put the chart in a parent container and apply the size dimensions on the parent element. Please refer to the following updated sample and let us know if you face any issues:

    https://jsfiddle.net/mh9xp12z/

    Regards

    Sharad

  • Posted 6 November 2020, 9:39 am EST

    Thanks for the solution. Somehow I still feel that reseting back all of the parent container’s property to the state when the chart is created is kind of unexpected. IMHO, removing the properties/classes that wijmo added is the way to go.

  • Posted 8 November 2020, 11:59 pm EST

    Hi Yifan,

    We cannot save most of the things added on the parent div. For example, we will have no idea whether an event listener is added by the user or Wijmo. Similarly, there are other methods or CSS properties and of course the dimensions.

    So, the best option in this scenario is to save the original HTML of the element.

    I hope this helps.

    Regards,

    Ashwin

  • Posted 10 November 2020, 9:50 am EST

    Hi Ashwin, thanks for the reply. I know it could be a little hassle but I’m not quite sure why most of the things added to the parent div cannot be saved. Like for event listeners there would be handler function name or namespace, and for other properties that wijmo added/modified on that parent container, they would be traceable by saving them in a dictionary. So those can be properly reset after disposing of the chart. If an event listener is added by the user, then it should just leave it as it is. Same for other properties (e.g., background-color, width, height) that users have modified for the parent div after the chart is created, they should be left untouched when the chart is disposed.

    By saving the original HTML it would save a lot of effort and it’s pretty straight-forward, but it would affect further interaction with the container once the chart is created and it would also cause confusion when the chart is disposed.

  • Posted 11 November 2020, 3:11 pm EST

    Hi Yifan,

    Thanks for the detailed information. I will have to ask the developers whether they will be able to implement this, so I have forwarded a report with internal tracking id 469154. I will update you once I will hear from them.

    ~regards

  • Posted 11 November 2020, 6:46 pm EST

    That’s great! Thank you. I really appreciate your help!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels