Skip to main content

Add dynamic comments to a chart

Add context to your data by layering on descriptions with Marks. Descriptions can be added manually into a SQL cell.

Harriet McCay avatar
Written by Harriet McCay
Updated over 2 months ago

The guide explains how to add dynamic comments to a chart, which will end up looking like this:

Adding descriptions via SQL

1) Create a new SQL cell - this will be where you can assign an event to a key date. Make sure to define the key date and description as separate columns.

You're essentially creating a dataset here that will be added later as an additional Mark on the visual.

2) Join your table with your descriptions and corresponding events to your main data source using your dates column.

3) Plot your data as you would normally - here we're plotting a line chart.

Add a Bar Mark to layer on your descriptions.

Pull in your fields as you did for the line chart, then add your description column into the Color slots.

4) We have to do some final tweaking to the color palette.

Navigate to the Bar mark and click on Color. Click on 'Edit overrides' to adjust the color of each bar, as shown.

5) Add a Text Mark to layer on your descriptions.

Add in your date column.

Add in your description column into Text.

Pull in your event_description column into the Y axis to define the position of your description.

See the full canvas example here.

Did this answer your question?