> For the complete documentation index, see [llms.txt](https://documentation.dnanexus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.dnanexus.com/user/cohort-browser/chart-types/stacked-row-chart.md).

# 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 following stacked row chart example, the primary field is *VisitType*, while *DoctorType* is the secondary field. The cohort was split 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 this example, 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 this example, 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
