# VISUALIZE

> Pick the chart, the metric it draws, bar-and-line combos, and how many items it shows.

`VISUALIZE` picks the chart and the metric it draws. Without it, the report picks a chart that fits the data: a single number, a line over time, or bars for groups.

```sql
FROM deals
SHOW won_value
GROUP BY owner
VISUALIZE won_value TYPE horizontal_bar MAX 10
```

## Syntax

```sql
VISUALIZE [<metric>] [TYPE <type>][, <metric> TYPE <type> ...] [MAX <n>]
```

- The metric must be one you `SHOW` (or its `AS` name).
- `MAX` sets how many items the chart shows.
- Give two metrics different types for a combo chart:

```sql
VISUALIZE value TYPE bar, count TYPE line
```

When the two metrics of a combo chart have very different sizes, each gets its own panel on the same axis instead of a second scale.

## Chart types

| Type | Best for |
|---|---|
| `metric`, `gauge` | One number |
| `line`, `area` | Trends over time |
| `bar`, `stacked_bar`, `grouped_bar`, `horizontal_bar`, `stacked_horizontal`, `grouped_horizontal` | Comparing groups |
| `combo` | Bars for one metric and a line for another |
| `breakdown_bar`, `donut`, `pie`, `treemap` | Share of a total |
| `sunburst` | Two groupings as nested rings (the first inside, the second outside) |
| `rfm_grid` | Contacts by RFM segment (see below) |
| `funnel`, `waterfall` | Steps and how they add up |
| `heatmap`, `calendar_heatmap` | Patterns across two groupings, or across days |
| `scatter`, `bubble`, `radar` | Comparing several numbers per group |
| `histogram` | How values are spread |
| `table`, `list_by_metric`, `list_by_dimension` | Exact values |
| `cohort_grid`, `retention_curve` | [Cohort reports](https://workstation.repzo.com/docs/analytics/repzoql/cohort) |

In the report builder, the chart picker searches these types and recommends the ones that fit. For tables, **Show all rows** in the Visualization section switches between every row and only the first ones.

## RFM grid

`rfm_grid` shows contacts by **RFM segment**, Shopify's customer segments. Every contact who bought (an issued invoice or an order that wasn't canceled) gets a score from 1 to 5 for how recently they bought, and one for how often and how much, compared with the workspace's other buyers. The pair places them in a segment: Champions, Loyal, Active, New, Promising, Needs attention, At risk, Previously loyal, Almost lost, or Dormant. Contacts without purchases are Prospects.

```sql
FROM contacts
SHOW count
GROUP BY rfm_group
VISUALIZE count TYPE rfm_grid
```

The grid puts recency across and frequency + spend up; each segment shows its value and its share of buyers. `rfm_group` also works in `WHERE`, for example `WHERE rfm_group IN ("At risk", "Previously loyal")`.

## Related pages

- [Reports](https://workstation.repzo.com/docs/analytics/reports)
- [COHORT](https://workstation.repzo.com/docs/analytics/repzoql/cohort)
