How to set GOJS shape location?

How to set location of shape added in GOJS.Parts

I’m not sure what you are asking about.

The location of a Part in document coordinates can be set by setting or binding the Part.position or the Part.location property. http://gojs.net/latest/intro/viewport.html

The location of a Shape within a Panel (including any top-level Panel such as a Node) depends on the type of Panel that you are using, on any sibling elements in the Panel.elements list, and on the properties that the Shape and the Panel and the other elements have. http://gojs.net/latest/intro/panels.html

Currently our implementation is
1)Crate free hand drawing using free hand drawing tool and return SVGPathString
2)we parsed this string and read model.nodeDataArray
3)We iterate this model.nodeDataArray and create shape every iterate node
//parse geomatry string to object
var drawingObject = JSON.parse(strSVGPathString);
for (var i = 0; i < drawingObject.model.nodeDataArray.length; i++)
{
//create geometry sting for each drawing and add it into parent node
shape = new go.Shape();
var point=go.Point.parse( drawingObject.model.nodeDataArray[i].loc)
shape.geometry = go.Geometry.parse(drawingObject.model.nodeDataArray[i].geo);;
shape.stroke = drawingObject.model.nodeDataArray[i].stroke;
shape.strokeWidth = drawingObject.model.nodeDataArray[i].strokeWidth;
shape.fill = null;
shape.alignment= new go.Spot(0, 0, point.x, point.y);
drawing.add(shape);
}
So it will display all shape in correct position except top one left shape
so is there any other option for setting position of shape in node.

What is “drawing” in your code? If it is a Panel of type Panel.Position, try setting shape.position rather than alignment.

You might need to set Shape.isGeometryPositioned to true.

drawing is part
drawing = new go.Part(go.Panel.Position);
We have set
shape postion rather than alignment but same issue we have faced
shape.position.x=point.x;
shape.position.y=point.y;

OK, it’s good that your Panel (which happens to be a Part) is of type “Position”.

But you cannot modify the Point object returned by GraphObject.position. If you use the debug version of the library, you will get an error.

Instead you need to do: shape.position = point;