Hello,
I’m creating a graph with some nodes with a shape and a text inside.
The shape it has to be always in the leftmost position and the text it has to fill the remaining space.
Something like this:
This is the code for the node template:
myDiagram.nodeTemplate =
$(go.Node, "Auto",
{
fromSpot: go.Spot.BottomSide,
toSpot: go.Spot.TopSide,
},
new go.Binding("text", "text"),
$(
go.Panel,
"Auto",
$(go.Shape, "RoundedRectangle",
{
fill: "lightgray",
stroke: null,
desiredSize: new go.Size(250, 50)
},
new go.Binding("fill", "fill")
),
$(go.Panel, "Horizontal",
{
stretch: go.GraphObject.Fill,
},
$(go.Shape, "RoundedRectangle",
{
width: 20,
height: 20,
fill: "lightgreen"
},
),
$(go.TextBlock,
{
stretch: go.GraphObject.Fill,
width: 225,
height: 20,
textAlign: "center",
background: "lightgreen"
},
new go.Binding("text", "text2")
),
)
)
);
As you can see I fixed the width in the TextBlock, but I would like to use something like go.GraphObject.Fill
in order to obtain a dynamic solution. Is it possible?