Javascript InfoVis Spacetree - dynamically hide / show tooltips

I searched this and couldn't find an answer. I will also ask about this in the Google Analytics group for InfoVis Toolkit.

I was wondering if it is possible to dynamically hide / show tooltips using InfoVis spacetree. They are currently enabled and I have set up tips like this:

Tips: {
        enable: true,
        type: 'HTML',
        offsetX: 10,
        offsetY: 10,
        onShow: function (tip, node)
        {
            tip.innerHTML = getToolTip(node);
        }
    },

      

but I can't find links on how I can disable them later. For example, I want the user to be able to check a checkbox to hide / show tooltips and then display them accordingly. I tried st.tips.hide () (st is the name of my spacetree) but it doesn't do anything. If I do alert (st.tips) I get the object, but I don't know what functions are available for the object.

Any help would be greatly appreciated! Thank!

+3


source to share


1 answer


I am using ForceDirected and have a similar problem. I would like to keep the tooltip for a certain period of time after the user leaves the node with the cursor ...

Call

graph.tips.hide(false)

      

works for me (have you ever tried passing an argument to hide?). I cannot tell you whether to convey true or false, they both work for me ...

In general, you can try something like:



Tips: {  
      enable: true,
      type: 'HTMl',
      onShow: function(tip, node, isLeaf, domElement) {
          //Check if checkbox is checked
          var checked = $('input[type=checkbox]').is(':checked');

          if (checked == true){
            tip.innerHTML =  getToolTip(node);
          } else {
            graph.tips.hide(true);
          };
      } 

      

Anyway, this is just an idea and I don't have time to test it (pseudocode? ..)

Hope this helped!

Greetings

+4


source







All Articles