Quarto Dashboards
In Lesson 1 you made single charts talk back: you wrapped Maya's bakery scatter in ggplotly() for hover, and pinned her six coffee-and-pastry shops onto a leaflet map. Useful, but each one lived in its own window. Maya kept five browser tabs open and a printout on her desk, flipping between them to answer one question.
A dashboard ends the tab-juggling. It takes those separate tiles, the headline numbers, the trend line, the by-shop bars, the map, and arranges them on a single page so the whole business is visible at a glance. Better still, it can link them: pick one shop and every tile narrows to that shop at once.
That is exactly the dashboard below. Move the Area filter and watch all three value boxes and both charts answer together. You will build this yourself, from a plain text file and with no web server.
By the end of this lesson you will be able to:
- Say what a Quarto dashboard is: one
.qmdfile withformat: dashboardthat renders to a laid-out page of tiles - Lay out a dashboard as a grid of rows and columns, and drop a chart into a card
- Build value boxes, the big headline numbers, by computing them in R
- Link several views with crosstalk so selecting in one filters the others, with no server
Prerequisites: you can run R and load a package with library(), you have built a ggplot (data, then aes(), then a geom) in the ggplot2 course, and you made a single interactive chart and map in Lesson 1. Every new term is defined as it appears.
One file, one screen
A Quarto dashboard is not a new app you learn or a server you run. It is a single plain text file, a **.qmd (Quarto markdown) document, that you render** into a finished web page. The same file you would knit into a report, with one line changed.
That one line lives at the very top, in the YAML header (the small settings block fenced by --- lines). Swap format: html for **format: dashboard and Quarto stops stacking your content as a long report and starts arranging it as a tiled dashboard instead. Toggle the widget below between Source (.qmd) and Rendered** to see the same file as text you write and as the page it produces.
Everything in this lesson is built from Maya's six shops. Each lesson runs in a fresh R session, so we build that data right here (run this once, then every later block can use it):
format: dashboard does the laying-out. You never write the HTML or CSS yourself.