I used the setCategoryForNodeData method to change the category of the group as follows
this.myDiagram?.model.setCategoryForNodeData(node.data,‘margin’)
GroupTemplate:
this.myDiagram.groupTemplate =
this.$(go.Group, ‘Vertical’,
{
layout: this.$(go.TreeLayout, {
layerSpacing: 100,
// setsPortSpots: false,
angle: 90,
},
),
selectionAdornmentTemplate: this.$(go.Adornment, ‘Auto’, this.$(go.Shape, ‘Rectangle’, {fill: ‘white’, stroke: null})),
isSubGraphExpanded: true,
},
this.$(go.Panel, 'Auto',
// new go.Binding('margin', '',this.test.bind(this)),
this.$(go.Shape, 'RoundedRectangle', // surrounds the Placeholder
{
parameter1: 14,
fill: 'rgba(128,128,128,1)',
stroke: 'rgba(1, 1, 1, 1)',
margin: new go.Margin(305, 0, 0, 0),
}),
this.$(go.Placeholder, // represents the area of all member parts,
{padding: 5}), // with some extra padding around them
),
);
this.myDiagram.groupTemplateMap.add('margin', this.$(go.Group, 'Vertical',
{
layout: this.$(go.TreeLayout, {
layerSpacing: 100,
// setsPortSpots: false,
angle: 90,
},
),
selectionAdornmentTemplate: this.$(go.Adornment, 'Auto', this.$(go.Shape, 'Rectangle', {fill: 'white', stroke: null})),
isSubGraphExpanded: true,
},
this.$(go.Panel, 'Auto',
// new go.Binding('margin', '',this.test.bind(this)),
// {margin: new go.Margin(305, 0, 0, 0),},
this.$(go.Shape, 'RoundedRectangle', // surrounds the Placeholder
{
parameter1: 14,
fill: 'rgba(128,128,128,0)',
stroke: 'rgba(1, 1, 1, 0)',
margin: new go.Margin(0, 0, 0, 0),
}),
this.$(go.Placeholder, // represents the area of all member parts,
{padding: 5}), // with some extra padding around them
),
));
Attributes like fill and stroke change depending on the category, but margin does not。
I don’t know how to solve it, please help me