How to add conditional statements to your popups
Very often, you may need to display different information for various regions of your map. While there are multiple ways to do this, one of the most straightforward methods is to use IF statements. These are logical conclusions that help you set different content in your popups and panels, depending on whether certain series fulfil a condition or not.
WARNING: At the moment, not all Flourish templates support IF statements.
Chord diagrams, Tables, Network graphs, Election results charts, Connections globes, Slope charts, Heatmaps and Arc maps currently DO NOT support this function.
The syntax is as follows:
{{#if No-popup}} This popup only shows up if the region <b>has no data</b>. {{/if}}
,
where {{No-popup}}
is the name of our new column.
What the IF statement function does is take into consideration which series have any content in the {{No-popup}}
column, and applies the specified message only to the cells that are not empty. In addition, you can customize the popup content in multiple ways – read more about using custom HTML and CSS here.