How to reset control over treemap after first display?

I use thejit treemap to display the first 50 most frequently used words from a TXT file. My code is deployed here .

After the first loading of the text, I get the JSON result and bind it to the jj control. All is good so far. However, if I do another file upload without manually refreshing the page, I get a result when the fields from the first result overlap with the fields from the second load.

See picture below.

overlapping of json

Question: how do I reset this control to display only new JSON and discard any previous data?

+4
source share
1 answer

Clear the div containing the visualization before loading into the new data.

In the first line of your InitTreeMap function (before the line var tm = new $jit.TM.Squarified({ ), add the following:

 $('#infovis').empty(); 
+3
source

All Articles