# Stacked Row Chart

{% hint style="info" %}
An Apollo license is required to use Cohort Browser on the DNAnexus Platform. Org approval may also be required. [Contact DNAnexus Sales](mailto:sales@dnanexus.com) for more information.
{% endhint %}

## When to Use Stacked Row Charts

Stacked row charts can be used to compare the distribution of values in a field containing categorical data, across different groups in a cohort. In a stacked row chart, each such group is defined by its patients sharing the same value in another field that also contains categorical data.

When creating a stacked row chart:

* Both the primary and secondary fields must contain categorical data
* Both the primary and secondary fields must contain no more than 20 distinct category values

| Supported Data Types                        |                                             |
| ------------------------------------------- | ------------------------------------------- |
| Primary Field                               | Secondary Field                             |
| Categorical (<=20 distinct category values) | Categorical (<=20 distinct category values) |

{% hint style="info" %}
Categorical multiple and categorical hierarchical data are not supported in stacked row charts.
{% endhint %}

## Using Stacked Row Charts in the Cohort Browser

In the stacked row chart below, the primary field is *VisitType*, while *DoctorType* is the secondary field. In this chart, a cohort has been broken down into two groups, with the first sharing the value "Out-patient" in the *VisitType* field, while the second shares the value "In-patient."

The size of each bar, and the number to its right, indicate the total number of records in each group. In the chart below, for example, you can see that 3,179 records contain the value "Out-patient" in the *VisitType* field.

Each bar contains a color-coded section indicating how many of the group's records contain a specific value in the secondary field. Hovering over one of these sections reveals how many records, within a particular group, share a particular value in the secondary field. In the chart below, for example, you can see that 87 records in the first group share the value "specialist" in the *DoctorType* field.

![Stacked Row Chart: VisitType x DoctorType](/files/XfLMsvE8rU9Q0ao3UGT4)

### Cohort Compare

Stacked row charts are not supported in Cohort Compare. Use a [list view](/user/cohort-browser/chart-types/list-view.md#list-views-in-cohort-compare) instead.

## Preparing Data for Visualization in Stacked Row Charts

When [ingesting data using Data Model Loader](/developer/ingesting-data/data-model-loader/ingestion-data-types.md), the following data types can be visualized in stacked row charts:

* String Categorical
* String Categorical Sparse
* Integer Categorical


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.dnanexus.com/user/cohort-browser/chart-types/stacked-row-chart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
