Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

hide tooltips associated with visualization when removing the visualization #18

Open

Description

@NoobTW

Hi, I'm using treemap in this package. It works well but after I hide the treemap, the tooltip doesn't hide. The .d3plus-tooltip is still there in the DOM.

Activity

  1. davelandry commented on Feb 13, 2018

    @davelandry
    Member

    @NoobTW can you share the code you have written to hide the Treemap?

  2. changed the title [-]d3plus-tooltip doesn't hide when d3plus hide[/-] [+]hide tooltips associated with visualization when removing the visualization[/+] on Feb 13, 2018
  3. NoobTW commented on Feb 13, 2018

    @NoobTW
    Author

    Not sure if I did this right, but here's the code: https://github.com/NoobTW/od-freq/blob/master/src/App.js#L110

  4. davelandry commented on Feb 15, 2018

    @davelandry
    Member

    Thanks for sharing @NoobTW. In the meantime, before the fix is implemented, you might be able to hack it (I haven't tested this though). At the top of the render function, save the handleClick function to a variable:

    const handleClick = this.handleClick.bind(this);

    And then try this for your click function:

    on:
      click: function(d) {
        this._tooltipClass.data([]).render();
        handleClick(d);
      }
    }

    This is all based on the default internal click function, which has access to the tooltip through it's context: https://github.com/d3plus/d3plus-viz/blob/master/src/on/click.js

  5. NoobTW commented on Feb 19, 2018

    @NoobTW
    Author

    Thanks for the hack, but I'm unable to access this in click function.

    on: {
    	click: function(d) {
    		// this._tooltipClass.data([]).render();
    		console.log(this)  // This is undefined.
    		handleClick(d); // Still works because I saved it to a variable.
    	}
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions