Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How-To: Hover hyperlink node to display value of text as tooltip instead of link

$
0
0

@brianc wrote:

Hi all,

I am creating a node with hyperlink. Whenever I hover the text, the link specified is displayed as a tooltip. Is it possible for the tooltip to display the text value instead of link?

Here are my simplified codes:

var $ = go.GraphObject.make;

    myDiagram =
      $(go.Diagram, "myDiagramDiv",
        { initialContentAlignment: go.Spot.Center });

    myDiagram.nodeTemplate =
      $(go.Node, "Auto",
        $(go.Shape, "RoundedRectangle", { stroke: null }, new go.Binding("fill", "bgcolor")),
        $("HyperlinkText",
          function(node) { return "https://www.google.com"; },
          function(node) { return node.data.longtext; },
            { stroke: "white", font: "bold 30pt arial", maxSize: new go.Size(300, NaN), wrap: go.TextBlock.WrapFit }
        ), { toolTip:
          $(go.Adornment, "Auto",
            $(go.Shape, { fill: "#FFFFCC" }),
            $(go.TextBlock, { margin: 4 },
              new go.Binding("text", "tooltip"))
          ) }
      );

    myDiagram.model = new go.GraphLinksModel([
      { key: 1, bgcolor: "red", longtext: "Looooonnnngggg text here", tooltip: "<%=strName1%>" },
      { key: 2, bgcolor: "green", longtext: "Another looooooooooooooonnnnnnnggggg text here", tooltip: "<%=strName2%>" },
    ],[
      { from: 1, to: 2 }
    ]);

If you hover the text, “www.google.com” will be displayed as tooltip instead of the value of longtext. Need some help here.

Thank you.

Regards,
Brian

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles