How to hide charts conditionally
How to hide charts conditionally
Since Carbone v4.3.0, the drop formatter is available to delete charts and any element from a document. Be sure to request version 4 (or higher) of Carbone:
- For the Cloud API: set the header
"carbone-version":4 - For the Cloud Studio: Click on the top-right "settings" icon > click on "version" > Select
4.X.X.
:drop formatter on the documentationFor the following exemple, we want to drop a chart if a dataset is empty.
Include the Carbone tag {d.values:ifEM:drop(chart)} within a shape alternate text, title or description.
- the
d.valuesis a list of values to create a chart, coming from a JSON dataset - the
:ifEMis a conditional formatter checking if the list is empty. - the
:drop(chart)formatter is fired if the previous condition is true. The first argumentchartis required to defined the element to drop.
Locations to insert tags for:
- LibreOffice: Right click on the chart > properties >
Optiontab > Insert the drop expression{d.values:ifEM:drop(chart)}in the name, text alternative or description field - MS Word: Right click on the chart > click on "edit alt text" > insert the drop expression
{d.values:ifEM:drop(chart)}

Updated on: 03/07/2025
Thank you!
