GOJS - Node locationSpot doesn't work

I want to place one node at bottom right in my diagram. so i set locationSpot property to go.Spot.BottomRight. I also removed default initialContentAlignment property in a diagram. Even then when ever i add node data to diagram it is placed at TOP Left position by default.

locationSpot only determines where the location point is on a Part, in distinction with the position which is always at the top-left corner of the Part.

It has no effect on where the Part is located in document coordinates – i.e. that locationSpot property has no effect on any Layout. The Diagram.layout is what is assigning the Part.location, I’m guessing to (0,0) for each new Node.

I don’t know what you really want, so I cannot recommend anything other than the general suggestion to set Diagram.layout to something.

ok. actually my use case is to create a fixed toolbar inside gojs diagram which has zoom in zoom out functionality.

assume that the placeholder in which toolbar is located is a diagram. Is it possible to achieve such thing with goJs?

Yes, see GoJS Legends and Titles -- Northwoods Software for some possibilities.

Can these legends can be an html file content? i mean can we replace node template with some html content

According to the example, part doesn’t have _viewPositioin property . i have the latest version of gojJS.

Yes, the legends can be HTML content instead of GoJS Parts. To do that you simply overlay HTML on top of the HTML DIV that makes the Diagram, and this HTML does not interact with GoJS code except at your own discretion (when you click an HTML button, you can have it call myDiagram.commandHandler....)

In many ways this is often easier than trying to make static fixtures in GoJS, though it requires its own careful HTML/CSS.

but if i add html on top of diagram div , it will appear at the top of it. i want to use html content inside gojs diagram like node template rendered in html.

HTML can appear anywhere alongside the Diagram Div as long as they are siblings:

  <diagram div>
  <the other content>

This is how we get the data visualization sample to work. It uses HTML overlaid on top of the div (dynamically, when you move the mouse over it). You code would be simpler than that.

You cannot use HTML to make Parts inside GoJS.

this is not what i want .my use case is to create a fixed toolbar inside gojs diagram which has zoom in zoom out functionality.

now if zoom in zoomout buttons are gojs part i am not able to place them at bottom right of respective diagram. can you help me do that?

It is what you want if you want a fixed toolbar. Here is an example:


Two HTML Buttons that are fixed on top of the Diagram. If you click the green one, it will zoom in. If you click the red one, it will zoom out. This is just a demonstration of how its possible to do with HTML.