With the advent of the option to dynamically bind colors to different parts of a component, we can push alerting to another level. For example, we may have a sales chart for a set of regions and may want to signal whether something is critically wrong. Instead of having a bunch of green and red bars that may look like a Christmas tree, we can set the chart background color to red if one of the values has reached a critical point. In this scenario, a user will be drawn to the chart right away, as it will be ringing alarm bells.
Be sure to have your chart data ready, shown as follows. In this recipe, we will have a set of sales data for each region. You may use the setup from the previous recipe, Adding alerts to a column chart, to help save you time.
Using bindable colors, we can dynamically set color properties for almost any component. In our example, we use a simple COUNTIF
statement to determine whether any of the region sales are below the critical threshold. From there, we have another IF
statement that determines the coloring of the chart background. The first case (the left-hand side graph in the following screenshot) shows that all our sales are above $200; thus, the chart background is white. The second case (the right-hand side graph in the following screenshot) shows that the sales in the West region are below $200; thus, a major alert is shown and the chart background becomes red.
There are many ways to customize alerting for different components. Our example only shows one way to do so. The easiest way can be found in the Adding alerts to a column chart recipe. To learn more about customizing charts to your desired look and feel, read the recipes in Chapter 7, Dashboard Look and Feel.