Reputation: 179
I'm trying to draw a semi ellipse object in GoJS which can supposedly be filled with a specified color through JSON data. The geometry string for the ellipse is generated by another javascript method and is working correctly and did output the correct object into the GoJS diagram. I did define a template map for that object which is shown below:
function ArchNodeTemplate(){
return $(go.Node,
{
locationSpot: go.Spot.TopLeft,
locationObjectName: "SHAPE",
resizable: false,
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("movable", "readOnly"),
new go.Binding("reshapable", "readOnly"),
new go.Binding("resizable", "readOnly"),
new go.Binding("rotatable", "readOnly"),
new go.Binding("groupable", "readOnly"),
new go.Binding("deletable", "readOnly"),
new go.Binding("copyable", "readOnly"),
$(go.Shape,
{ stroke: "#ababab",
name: "SHAPE",
strokeWidth: 2,
strokeDashArray: [5,2],
},
new go.Binding("geometryString", "geo"),
new go.Binding("fill", "color")),
);
}
Geo string generated from a separate method is something like this:
m 0 0 a 30 100 0 0 1 0 200 l 0 -200 z
This is the object that's created and the one which I wish to fill with color.
Now I did try experimenting with the other objects within my diagram and they work just fine, except for this generated shape. I also checked the sample codes in GoJS's website (and their downloadable library) and looked at the codes similar to this one (specifically the floor planner sample) and everything seemed to be the same. Am I missing something here?
Upvotes: 0
Views: 471
Reputation: 4156
Yes, you are missing prepending the path geometry string with "F1 ", which you can also accomplish programmatically by calling https://gojs.net/latest/api/symbols/Geometry.html#static-fillPath.
Upvotes: 2