📈Charts

Create a pie or bar chart connected to API data

Visualize your API data in a chart! With this component, you can create data visualizations inside your apps with data obtained from your backend tool.

🏷 The tags

Bravo supports 2 chart types at the moment: pie and bar. Depending on the data you want to visualize, you may find the most suitable format.

To create a pie chart:

[component:chart:pie]

To create a bar chart:

[component:chart:bar]

⚒️ How to set it up

🎨 Design file setup

To add a chart component, create a rectangle element in your design file and add the tag [component:chart:X] to it, replacing X with one of the chart options described before. Place it inside a container.

We recommend creating another rectangle element as a background, inside the same container. This is shown in the screenshot below, and also in the example design file.

That's all you need in your design file to create a chart component! Now, it's time to import it into Bravo and connect it with some data.

🔌 Bind the charts to data

Depending on the chart type you're using, you'll be able to bind different properties to it. A chart needs to be bound to a list data item. Each of the items in the list will be a data element in the chart, where each chart can contain as many data elements as needed.

At the same time, each of the list data items obtained with the API request must contain individual data items that will be bound to the corresponding properties described below.

To get started, you can use our sample Airtable base, by duplicating it and using the Airtable wizard in the Data Collections section to create some API requests targeting the base. This way, you'll already have some data to bind to the chart component.

🍰 Pie charts

A pie chart contains the following properties:

  • Chart data: this property must be bound to a list data item, containing all the data elements of the pie chart. This property has three subproperties inside it:

    • Value: the numeric value of a data element in the chart. In a pie chart, the percentage of each data element value, compared with the sum of values of all data elements, will be represented. This property needs to be bound to a numeric data item.

    • Color: the color of the pie portion corresponding to a data element. Needs to be bound to a data item containing the HEX representation of a color. (For instance, #FFFFFF for white). If this property is left unbound, a default color will be used.

    • Name: the tag name that will show together with the pie chart element.

  • Chart title: optionally, you can add a title to the chart. This is done by binding this property to a single data item containing the chart title.

The properties of the pie chart component are bound as shown below, in Bravo's Data Binding section.

📊 Bar charts

A bar chart contains the following properties:

  • Chart data: this property must be bound to a list data item, containing all the data elements of the bar chart. This property has three subproperties inside it:

    • Value: the numeric value of a data element in the chart. In a bar chart, each data element will be represented as a bar, and will have a height proportional to its value, and the value of the other data elements.

    • Color: the color of the bar corresponding to a data element. Needs to be bound to a data item containing the HEX representation of a color. (For instance, #FFFFFF for white). If this property is left unbound, a default color will be used.

    • Name: the tag name that will show together with the bar chart element.

  • Chart title: optionally, you can add a title to the chart. This is done by binding this property to a single data item containing the chart title.

The properties of the bar chart component are bound as shown below, in Bravo's Data Binding section.

📲 Preview on Bravo Vision

Once you have imported the design file with the chart component and bound the data, you can see the charts on Bravo Vision!

💾 Example files

Design file

Airtable base

Last updated