Consistently change formatting and visualize data to make it readable and insightful.
Whenever you want to consistently change the look and design of your presentation or visualize data in a specific way, look for rules. Rules can be simple, such as changing the font color, or more advanced, such as displaying data-dependent and context-aware icons, charts, and shapes.
Rules save time and ensure consistent results
Traditionally, formatting is tied specifically to the element it applies to. There are several issues with this when creating professional presentations. For example, suppose you have a simple table where you want negative numbers to be red and positive numbers to be green. With traditional formatting, you'll select the number and color it based on its value. This operation must be repeated for each value every time new data is added. This is tedious and leaves many possibilities of error. Suppose some numbers change during your analysis, going from positive to negative. The formatting must be reapplied, creating more work and leaving new possible errors. The core problem is that the formatting is applied to each individual piece of content rather than the intention of behavior being defined.
Using rules in Grunt, you can define this type of behavior and many others. This saves a lot of work maintaining a document and ensures quality and consistency.
The separation of content/data and formatting is the same division used in the separation between HTML and CSS and many other parts of computer science.
But we've also taken this basic concept of formatting with rules to the next level. Rule formatting in Grunt includes not only simple properties like colors and sizes but also any visualization of data. You can turn negative and positive numbers into a chart, some Harvey balls, colored arrow icons, or other data visualization options. The interaction and core philosophy are the same; formatting is a rule applied on top and separate from your data.
Rules ensure consistency, guarantee quality, and enable reusability on a completely different level than other approaches.
Adding a rule
Start by selecting the part of your Grunt object you want to change. Then either right-click and choose "Add rule" or use the shortcut key Ctrl
+ Enter
.
A dialog box containing all the rules available in the current context will appear. There are many of them, and you can scroll through the list to better understand what is available. If you know what rule you are looking for, you can also search for it. Double-click the rule to add it to your object when you've found what you want.
You can read more about specific rules and their properties in separate articles.
Property section
At the top of the rule view, you'll find the property section, where the available properties of the rule are displayed. When added, most properties will be in the "Default" state. In this mode, they do not change anything in your object.
To activate a property, simply click the "+" icon next to it. This will activate a property control that you can adjust as you like.
Click the "-" icon to revert to the default state.
Some properties will have more modes than "active" or "inactive." If so, clicking the "+" button will open a menu of the available modes.
Target section
The bottom gray part of the rule view is the target area, which determines where a rule is applied. Basic targets can be specific rows or columns, but they can also be more advanced, like cells with numbers above a certain value or shapes containing specific text. The simplest way to choose a target is to select it before adding the rule — the selected parts will then automatically be added as the target. You can also click the "+" icon to include or exclude specific parts of your object.
The Rule Stack
All rules will appear in the rule stack in the edge menu after being added. The order of the rules in the stack determines in which order they are applied, starting from the bottom and then going up. This means that if two different rules try to control the same thing to the same target, the topmost one will "win" and control the format. You can drag and drop rules in the stack to move them further up or down.
Why doesn't anything change when I add a rule?
Sometimes, you'll be changing the settings of a rule, and nothing seems to change visually. This is usually because there is another rule higher in the stack that overrides the setting, or nothing matches your target. Try selecting the cell or element in your Grunt to check which rules apply to that element. When selected, those rules targeting that specific thing will light up green in your rule stack.