Creating new table layouts in the Seat Planner demo


I’m evaluating GO JS to see if I can use it for a table planner. I have the demo working and have been able to add new rectangular tables with more seats. It’s been tedious and slow but doable.

I’m not trying to allow for circular tables that can accomodate more seats (12, 13, 14 etc).

I’m finding it extremely tedious in positioning the seats around the table. Is there a tool or automated way of doing this?


Did you mean “I’m now trying…” ?

You can create a function that creates templates, calculating the size of the table that you want and the number and positions of the seats. You’ll probably want to have one such function for round tables and one or two for rectangular tables.

In reality I think tables actually come only in discrete sizes, so you would need to take that into account.

Hi Walter,

Thanks for the prompt reply. Yes, I’m sorry, I meant “now trying”.

Any sample functions for achieving this? It’s the position of seats at circular tables that is causing me the real problems.


    function CSeats(total) {
      var seats = [];
      if (total > 0) {
        var p = new go.Point(0, -0.5);  // start at top
        var ang = 360 / total;  // go clockwise
        for (var i = 0; i < total; i++) {
          seats.push(Seat(i + 1, new go.Spot(p.x + 0.5, p.y + 0.5)));
      return seats;

Now you can define as many named templates as you like, such as:

    myDiagram.nodeTemplateMap.add("TableC12",  // circular with 12 seats
      $(go.Node, "Spot", tableStyle(),
        $(go.Panel, "Spot",
          $(go.Shape, "Circle",
            { name: "TABLESHAPE", desiredSize: new go.Size(120, 120), fill: "burlywood", stroke: null },
            new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
            new go.Binding("fill")),
          $(go.TextBlock, { editable: true, font: "bold 11pt Verdana, sans-serif" },
            new go.Binding("text", "name").makeTwoWay(),
            new go.Binding("angle", "angle", function(n) { return -n; }))

You may want to make it smarter, as I suggested earlier, so that it chooses the size of the table based on the number of seats. Clearly if you ask for 22 seats at the same size table, the chairs are going to have to overlap each other.

1 Like

Wow! Thank you so much, this has saved me so much time! I’d recommend adding that to the demo as it makes it so much easier to understand.

Thank you Walter!

Well, I suppose, but notice that that only works for circular tables, and it’s obviously still not smart enough to figure out the right table size given the number. And it assumed where to start with the first seat and which direction to go.

We assume our customers are programmers who are entirely capable of doing these kinds of abstractions once they’ve spent time becoming familiar enough with GoJS to understand what they can do with it.

I highly recommend that everyone read Get Started with GoJS and then all of the pages of the Introduction, starting at GoJS Introduction -- Northwoods Software, that apply to the kind of app they want to build.

Dear @walter,
I want generate seats like this:
Could you help me?
Thanks you in advanced.

As I said in my previous reply, once you are familiar with GoJS you should be able to implement such functionality.

But we can help you a little bit more once you have purchased a license with support.