Modifier targets in depth
A modifier consists mainly of two parts:
- The targets that specifies what the modifier will affect
- The settings that specifies how the modifier will affect the targets
This article delves into what targets are and how you can control them most effectively.
What are targets
Targets are important because they specify the modifiable parts of a Grunt object. Some times you want to change an underlying property of an entire Grunt object, and in this case your target would specify the Grunt object itself. Other times, you want to limit your modifier to just affect a minor part of the Grunt object, e.g. a specific column or an individual cell of a Grunt visual grid. In this case the target would specify the column or the cell.
There are multiple types of targets available to Grunt objects, the most common are:
- Structural targets are defined by structural properties, e.g. a column or a cell of a Grunt visual grid.
- Data targets are defined by the data contained in structural parts, e.g. all cells containing positive values or all cells containing a value equal to a user defined figure.
- Text targets are defined by some textual property, e.q. every first paragraph in a cell or every word matching a specific word filter.
What do I need to know to understand targets?
Targets are an advanced concept, but by understanding how they work you unlock more of Grunt's potential. Throughout this section, we will refer back to the following Fill alternating modifier settings dialog:
The targets area of the modifier settings dialog is the bottom-most half with a grey background. This is the three rows at the bottom of the dialog seen in the image.
- The target kind is the first part of targets. This is the blue “Cells” and “Graphics” button(s) seen in the image.
- The inclusion list is the second part of targets. This is the grey “Column 2” and “Column 5” buttons in the image.
- Finally, the exclusion list is the third and last part of targets. This is the grey “Positive values” button in the image.
We will go throuh these three parts in depth shortly, but first we will quickly explain the overall algorithm used to calculate the targets from these three parts. It should be feasable to follow the algorithm even though you don’t yet know the parts in depth.
To find out which targets of a Grunt object the modifier should affect, we use the following algorithm:
- First, collect all modifiable parts of the Grunt object in question.
- Then, remove all modifiable parts that don’t match the target kind.
- Then, remove all modifiable parts that don’t match the exclusion list.
- Then, remove all modifiable parts that don’t match the inclusion list.
- The final target is all the remaining modifable parts in your collection.
To get a better understanding of the targets, we will now go in depth on each of the three parts.
The inclusion list defines a list of granular targets that should be affected by a modifier. All items that are part of this list will be affected, and all items that are not part of this list will be unaffected.
Example: In the image below, two granular targets are defined; namely Column 2 and Column 5. With these two items in the inclusion list, the modifier will affect everything in these columns and nothing outside of these columns. Note however, that we will also need to account for the exlusion list and the targeting kind before we can reliably state whether a modifiable part is included or not.
Special case: If the inclusion list is empty it behaves in a special way. Instead of meaning that nothing is included, it means that everything is included. This means that if you have an empty list, the first item you add to the list will actually reduce the number of modifiable parts that are targeted, while every other item you add after the first one will expand the number of modifiable parts that are targeted.
The exclusion list defines a list of granular targets that should be left unaffected by a modifier. All items that are part of this list will be excluded from any influence by the modifier.
Note: The exlusion list takes precedent before the inclusion list, so if an item is present both in the inclusion list and in the exclusion list, the item will not be part of the final target.
If you look at all the modifiable parts of a Grunt object, some of them have common traits. Target kind is a grouping based on these traits. The blue buttons at the top of the target area let’s you change the target kind.
There are currently three available target kinds you can choose between:
- Cells, which let you target the underlying cell in a Grunt visual grid.
- Graphics, which enables you to target all graphics produced by modifiers. Examples of graphics are chart elements, Harvey balls or custom shapes.
- Text, which let you target text in your Grunt object.
Note: Depending on the type of modifier you are using, not all target kinds are present. If a modifier affects a property that is incompatible with a given target kind, then that target kind will be unavailable. All compatible target kinds will show up, and can be either enabled or disabled.
Example: Let’s imagine that you have added a modifier that affects the fill property of Grunt objects, and that you have a specific cell in the inclusion list, while the exclusion list is empty. Also, let’s imagine that the specific cell includes a graphical shape, e.g. a rounded rectangle. If the available target kinds are Cells and Graphics, we will have three valid combinations of the two:
- If the target kind is set to Cells, the fill property of the cell will be affected by the modifier, while the fill property of the graphical shape is unaffected.
- If the target kind is set to Graphics, the fill property of the graphical shape will be affected by the modifier, while the fill property of the cell is unaffected.
- If both Cells and Graphics are selected at the same time, both the fill property of the cell and the fill property of the graphic shape will be affected.