> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stockful.app/llms.txt
> Use this file to discover all available pages before exploring further.

# VISUALIZE

> Choose the chart type and the metric it plots

`VISUALIZE` turns the results into a chart. Name the metric to plot, then `TYPE` and a chart type. Without a `VISUALIZE` line the report renders as a table, which is the default.

```sql theme={null}
FROM sales
  SHOW total_revenue
  GROUP BY vendor
  ORDER BY total_revenue DESC
  VISUALIZE total_revenue TYPE bar
```

## Chart types

| Type                     | Renders                                                       |
| ------------------------ | ------------------------------------------------------------- |
| `table`                  | The results as a table (the default)                          |
| `bar`                    | The metric as vertical bars                                   |
| `line`                   | The metrics as a line chart                                   |
| `grouped_bar`            | Grouped by the 1st dimension, one bar per 2nd-dimension value |
| `stacked_bar`            | Grouped by the 1st dimension, stacking the 2nd dimension      |
| `stacked_area`           | The metrics as stacked areas                                  |
| `horizontal_bar`         | The metric as horizontal bars                                 |
| `horizontal_grouped_bar` | Horizontal bars grouped by the 1st dimension                  |
| `stacked_horizontal_bar` | Horizontal bars grouped and stacked by dimension              |
| `single_stacked_bar`     | Each category as a segment of one stacked bar                 |
| `donut`                  | Each category as a slice of a donut                           |
| `single_metric`          | The metric as a single headline number                        |

## Options

After the type you can add:

* `ITEMS <n>` caps the chart to its top N categories.
* `REMAINING hide | group | list` sets how the categories beyond the cap are handled. `group` folds them into one "Other" entry, `hide` drops them from the chart, and `list` leaves them in the results table.
* `RANKING overall` ranks a two-dimension chart by the global top series rather than each group's own top.

```sql theme={null}
FROM sales
  SHOW total_revenue
  GROUP BY vendor
  ORDER BY total_revenue DESC
  VISUALIZE total_revenue TYPE bar ITEMS 10 REMAINING group
```

For a chart that plots a trend over time, pair `VISUALIZE` with a [TIMESERIES](/stockfulql/syntax/timeseries), and overlay events with [ANNOTATE](/stockfulql/syntax/annotate).
