rbraun

Ever expanding DOM nodes (_SmartLabel_Container)

Recommended Posts

I am using JS charts and have found that a DOM node is added each time I update the chart data.  When I do a setChartData() a new div of class _SmartLabel_Container is created.  These don't ever seem to garbage collect and I end up with hundreds of them littering the DOM when I look with an inspector.  Is this expected and/or am I doing something wrong?  I assume disposing of the chart might get rid of them but I was simply hoping to push new data and not rebuild things from scratch.

 



<div class="_SmartLabel_Container" style="position: absolute; top: -9999em; white-space: nowrap; padding: 0px; width: 1px; height: 1px; overflow: hidden;"><canvas style="width: 0px; height: 0px;"></canvas><span style="font-family: Verdana; font-weight: bold; font-size: 10px; line-height: 14px; color: rgb(73, 86, 58); display: inline-block;">W...</span><canvas style="width: 0px; height: 0px;"></canvas></div>



Thanks,

Ryan

 

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Welcome to FusionCharts Forum.

 

Yes, starting from FusionCharts XT v3.3.0, the <div> with class name "_SmartLabel_Container" is expected, which will create automatically for JavaScript mode of rendering, to import the smart label.

 

So, could you please clarify a bit more on, whether it is causing any implementation issue at your end?

 

If yes, please provide some more information on the issue, so that we can better look into this issue.

 

Awaiting your valuable response.

Share this post


Link to post
Share on other sites

Hey, a way to stop this is to find and replace a line in FusionCharts.HC.js (for the latest 3.3.1 SR2 version.)

// search: 
e.prototype.constructor=e;k.prototype={dispose:function(){var d=this.container,e;

// and replace with
e.prototype.constructor=e;k.prototype={dispose:function(){var d=this.parentContainer,e;

If you have the source code, locate the definition of SmartLabelManager.prototye and dive into the dispose function. On the 2nd line in the function, replace container = label.container with container = label.parentContainer.

Share this post


Link to post
Share on other sites

Hi,

 

I have also noticed that a new div with css class _SmartLabel_Container is appended to the DOM each time a chart is rendered or updated in the 3.3.1-sr3 version.

These divs are never removed from the DOM even after a call to the default dispose() method.

Your replacement is doing the trick shamasis but is it planned to be fixed in future release ? because it is not a viable solution to make this manual change between each FusionCharts lib release.

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Yes, this issue will going to be fixed in the upcoming release. However, we are not able to provide any fix version and timeline for the release, as of now.

 

Further any updates on this, we will keep you posted.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now