4

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

After the first text upload I receive JSON result and bind it to thejit control. All good so far. However, if I do another upload of a file without manually refreshing the page I get the result where boxes from the first result overlap with boxes from the second upload.

See the picture below.

overlapping of JSON

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

oleksii
  • 35,458
  • 16
  • 93
  • 163
Alexandr
  • 5,460
  • 4
  • 40
  • 70

1 Answers1

3

Empty the div containing the visualisation before loading in the new data.

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

$('#infovis').empty();
Graham Clark
  • 12,886
  • 8
  • 50
  • 82