# Stacked Bar Chart

The Stacked Bar Chart layout allows to perform a part-to-whole comparisons over time or across categories. The setup is similar to that of the [Bar Chart](https://softr.gitbook.io/softr-documentation/building-blocks/chart/chart) with the only difference that you can select multiple fields for the **Y axis**. Let's consider a specific example to get a better idea of how this works.

In the example below, we have a quarterly revenue data for multiple companies.

![Company revenue data](https://3426011356-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0NiyhsmXAcV5u1c6XK%2Fuploads%2FFY1nETD6vi1AYk3ReZR2%2Fdata-airtable-b.png?alt=media\&token=f643e4ab-9c92-4f3a-9514-19224198ce47)

Using the stacked chart layout, we can present this data in a way that allows the viewers to compare a specific company's quarterly revenues with one another and with the yearly number. Moreover, it will also make it easy to compare the yearly revenues of the different companies visually.

To do this, we first need to connect out Airtable base and table from the **Data** tab in block settings and configure the chart settings (learn more in [Bar Chart](https://softr.gitbook.io/softr-documentation/building-blocks/chart/chart) overview). Lastly, we are going to map the fields and test result, which you can see below.

{% hint style="info" %}
Note that we also select a **Default View** for the data table to preserve the sorting we have on Airtable.&#x20;
{% endhint %}

![Mapping the fields and testing the result](https://3426011356-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0NiyhsmXAcV5u1c6XK%2Fuploads%2FcGbzKgVsBdqFN1bQRPXQ%2FScreen%20Recording%202022-08-22%20at%2010.20.39.gif?alt=media\&token=0dc2b138-590b-41db-8a8d-58ae52e9ab6c)
