Caveat: This has only been tested for Line and Bar charts. Not all chart types allow the vis config customizations that this approach relies on. Additionally, this is not an “official” workflow, it’s more of a hack that could potentially break at any point in the future. That said, I’m documenting it here because I think it’s cool & some folks might find it helpful 🙂
Problem:
You’d like to be able to add notes to a visualization, perhaps to call out a certain row of data, or add short comments to a visualization at specific points.
Solution:
Starting with a table like so:
If, for example, we wanted to show an annotation of "Orders at 2019-01: 941" at the first row, and "Orders at 2019-12: 1002" at the last row, we could use this to evaluate true for only those 2 rows:
row()=1 OR row()=max(offset_list(row(),0,count(${sc_orders.output_dim})))
And this to display the desired text:
concat("Orders at ", to_string(${created_date}), ":", to_string(${orders.count}))
Put it all together and we have:
if(row()=1 OR row()=max(offset_list(row(),0,count(${sc_orders.output_dim}))),concat("Orders at ", to_string(${sc_orders.output_dim}), ": ", to_string(${sc_orders.output_measure})),null)
A few examples of what this can end up looking like: