Legends and title positioning issue

i m using this code to proguce a title
this.diagram.add(
(go.Part, { location: new go.Point(0,-40) }, (go.TextBlock, “A Title”, {alignment: go.Spot.Top,font: “bold 14pt sans-serif”, stroke: “green” })));

but the positioning is nor effected if i change the points in location of new.go.point(0,-40)
all the dives use same diagram


i need the legend to be on the top right corner always

Remember that all Parts use document coordinates, not view coordinates. GoJS Coordinate Systems-- Northwoods Software

Have you read GoJS Legends and Titles -- Northwoods Software ?