Articles in this section
Category / Section

How to Remove Tooltip From Nodes and Connectors in JavaScript Diagram?

3 mins read

In our Graphical User Interface (GUI), a tooltip appears when you hover your mouse over an element. This message provides additional information to enhance your experience and understanding of the interface.
If you prefer not to see these tooltips, you can easily remove them by disable the tooltip constraints for nodes or connector respectively in JavaScript Diagram.
Below is a code example demonstrating how to disable the tooltip for nodes/connectors:

ej.diagrams.Diagram.Inject(ej.diagrams.HierarchicalTree);
//Initializes nodes for diagram

var nodes = [
 {
   id: 'Steve-Ceo',
 },
 {
   id: 'Kevin-Manager',
 },
 {
   id: 'Peter-Manager',
 },
 {
   id: 'John-Manager',
 },
 {
   id: 'Mary-CSE',
 },
 {
   id: 'Jim-CSE',
 },
 {
   id: 'Martin-CSE',
 },
];
//Initializes connectors for diagram
var connectors = [
 {
   id: 'Steve-Ceo_Kevin-Manager',
   sourceID: 'Steve-Ceo',
   targetID: 'Kevin-Manager',
 },
 {
   id: 'Steve-Ceo_Peter-Manager',
   sourceID: 'Steve-Ceo',
   targetID: 'Peter-Manager',
 },
 {
   id: 'Peter-Manager_John-Manager',
   sourceID: 'Peter-Manager',
   targetID: 'John-Manager',
 },
 {
   id: 'Peter-Manager_Mary-CSE',
   sourceID: 'Peter-Manager',
   targetID: 'Mary-CSE',
 },
 {
   id: 'Kevin-Manager_Jim-CSE',
   sourceID: 'Kevin-Manager',
   targetID: 'Jim-CSE',
 },
 {
   id: 'Kevin-Manager_Martin-CSE',
   sourceID: 'Kevin-Manager',
   targetID: 'Martin-CSE',
 },
];

var diagram = new ej.diagrams.Diagram({
 width: '100%',
 height: '650px',
 //Uses layout to auto-arrange nodes on the diagram page
 layout: {
   //Sets layout type
   type: 'HierarchicalTree',
 },
 nodes: nodes,
 connectors: connectors,
 //Sets the default properties for nodes
 getNodeDefaults: (obj) => {
   obj.shape = {
     type: 'Text',
     content: obj.id,
   };
   obj.width = 100;
   obj.height = 40;
   obj.backgroundColor = '#6BA5D7';
   obj.shape.margin = {
     left: 5,
     right: 5,
     top: 5,
     bottom: 5,
   };
   //define tooltip
   obj.tooltip = {
     content : obj.id
   }
   //disable the tooltip for node
   obj.constraints = ej.diagrams.NodeConstraints.Default & ~ej.diagrams.NodeConstraints.Tooltip
   return obj;
 }, //Sets the default properties for and connectors
 getConnectorDefaults: (connector, diagram) => {
   connector.tooltip = {
     content : connector.id
   }
   connector.type = 'Orthogonal';
   connector.constraints = ej.diagrams.ConnectorConstraints.Default & ~ej.diagrams.ConnectorConstraints.Tooltip
   return connector;
 },
});
diagram.appendTo('#element'); 

Sample

Conclusion
I hope you enjoyed learning how to remove tooltip from nodes and connectors in JavaScript Diagram.

You can refer to our JavaScript Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied