1. Text for Dashboards
The final dashboard component that we need to cover is text. Even though dashboards are primarily about visual display, text is often important to provide all the necessary information to the viewer.
2. Captions
The are several ways to add text to your dashboard. A common and effective method is to use captions, also called notes. Captions are added to a specific chart and will appear at the bottom of that chart. Captions are added with the greater than sign followed by text. Note that this needs to go outside of the R chunk, unlike most things we have added. There must be an empty line between the end of the code chunk and the caption.
3. Captions with inline code
As with all R Markdown, you can include inline R code in captions using the backtick r, then the code, then another backtick. This can be a useful way to create captions that are customized to the data.
4. Captions with inline code
When the dashboard is generated, the caption appears within the space allocated for that chart, and any inline code is replaced with the associated output value.
5. Storyboards
Another way to provide more context to your viewers with text is to use the storyboard format. This requires only small changes to your code, but it has a major effect on how your dashboard is delivered. Instead of components laid out to show multiple charts on a single page, a storyboard presents one chart at a time in a specified order and allows the user to progress through them. Across the top, a short description is shown for each chart which can be selected for view or navigated through with the arrows on left and right. The chart itself is shown below this section, with an optional panel for additional commentary on the right as shown here. This format is appropriate if your content is well presented in order or as a story.
6. Converting to a Storyboard
The key to making your dashboard a storyboard is to add storyboard: true to the yaml header.
7. Creating the story
Once the storyboard format is indicated in the header, each chart, becomes a step in the story. This example would have two parts to the story. What would have been the title of the chart in the standard dashboard format is now the description in the cards at the top of the storyboard. You will likely make them longer and more descriptive than if they were chart titles. Note that you should not have any column or row formating for a storyboard.
8. Adding Storyboard commentary
To add more information on each chart in the storyboard, you can add commentary using a triple asterisk. This needs to be after the end of the R chunk for the chart. Text, with all the standard R Markdown options like inline code, goes below the line with just three asterisks. Including this line will automatically create a right panel for this step of the story that will display the text you provide. You can provide this for some charts and not others.
9. Mixing Storyboards In
If you have a multi-page dashboard, you can use the storyboard format on some pages but not others. To do this, instead of adding storyboard: true to the yaml header, add it as an option to the page it applies to.
10. Let's practice!
Time to add some text!