Placement of sub-shapes within a group can sometimes become complex. The logic that determines their size and position can get buried in the individual shapes making it harder to get a clear view of what’s happening. One answer to this problem is the use of a grid system and I thought I’d explore this approach over the next couple of posts.
There are many things that can lead to complexity in ShapeSheet work, but certainly relationships between sibling shapes, and inverted relationships – where the parent has knowledge of its children are two key candidates for this.
While there can be good and pragmatic reasons for building shapes in this way, I find I’m more comfortable with keeping logic in the group and having clear visibility of where control lies as far as reasonably possible.
If you find yourself thinking in terms of ‘areas’ of a shape then the grid might well be a good fit for reducing the interdependencies between your shapes.
The Grid System
You can set up a basic grid in your group shape with the addition of four cells:
This isn’t a real, or at least a visible, grid and so the row and column count aren’t really necessary, just so long as you have some way of understanding what the equally spaced row and column sizes are and how they relate to your group shape.
Once you have your grid set up, you can then add the sub-shape logic (where Sheet.1 is the group shape):
In this state you’ve abstracted the size and position of the sub-shape to a set of (zero-based) row and column units that can be easily changed as required.
For example, in the following screenshot, where I’ve added some visual grid lines for clarity, you can see the above sub-shape positioned in the 7th row (row index 6) and the 3rd column (column index 2). The size of the shape is determined by the number of rows and columns it spans – 3 in this case.
For general layout, perhaps to arrange header and footer areas, you can place shapes relative to one another without explicitly defining the logic that ties the two together.
If you look at the header and footer example, suppose you start off with a group shape with just those two sub-shapes:
Ordinarily you might add a couple of user cells to the group shape to hold the respective relative heights. If you then wanted to add additional shapes that were placed relative the the header and footer areas you would need to reference these group level cells. That’s fine, but what happens when you later want to add, say, a legend area on the right hand side, covering the footer but not the header? At this stage you may well have quite a bit of rework on your hands as the logic might have reasonably assumed that layout was based on rows only.
If, on the other hand, you use the grid system, you only need to add the third sub-shape and set the row, column and span values for the footer and the new shape.
The grid system helps in making a flexible shape that can accommodate any number of changes as required.
A couple of extra points that are worth noting are:
a) you’re not restricted to using group shapes. The system would work equally well with page level cells.
b) the sub-shapes can accept negative values or numbers in excess of the Rows/ColumnsCount. Either of these options will see the sub-shape being position outside of the bounds of the group shape.
It’s this last point that I’m going to look at in the next post to see how you can use the grid system to position Data Graphic like icons around the outside of a shape.