# Chart types

> The seven chart types Emolysis dashboards use, what each takes, how numbers are combined and formatted, and how many series a chart shows.

A dashboard chart is described by a small, typed chart spec: a type, the fields it reads, how they map onto the chart and how numbers are formatted. The agent writes the spec, and the desktop app and the browser draw the same spec the same way, so a chart looks alike in both. The [sample dashboard](https://emolysis.com/d/sample) on this site draws every type below from synthetic data.

## The seven types

| Type      | Use it for                            | What it takes                                                             |
| --------- | ------------------------------------- | ------------------------------------------------------------------------- |
| `bar`     | Comparing values across categories    | A category on x, one to eight measures on y; stacked or horizontal        |
| `line`    | A trend over time                     | A time or category on x, one to eight measures on y; optionally stacked   |
| `area`    | A trend where the total matters       | The same as a line, with a fill; optionally stacked                       |
| `scatter` | The relationship between two measures | A value or category on x, measures on y; raw points, or points per x      |
| `pie`     | Parts of a whole, with few slices     | A category on x and exactly one measure on y; no series                   |
| `kpi`     | One headline figure                   | Exactly one measure on y; with a time x, a small trend line underneath    |
| `table`   | Exact values                          | Columns from x, series and measures; rows aggregated or shown as they are |

## Fields and encodings

A chart reads a set of rows from a named source, such as a gold table. Each field it uses is declared with a type: quantitative, temporal, nominal or ordinal. Three parts map fields onto the chart:

- **x** is the axis or category. It is required for bar, line, area, scatter and pie, and optional for KPI and table.
- **y** holds the measures: at least one and at most eight, and exactly one for pie and KPI. A measure is a quantitative field, unless it is only counted.
- **series** splits the data into one line, bar or area per value of a field. It is not available for pie and KPI.

Each measure can carry a label that replaces the field name on the chart.

## How values are combined

Rows that share an x value (and a series value) are combined with an aggregate: `sum`, `avg`, `min`, `max` or `count`. Without one, values are summed. A table with no aggregate shows the rows as they are, and so does a scatter with a numeric x and no aggregate.

Missing and non-numeric values are skipped, and an empty cell shows as a gap, not as zero.

## Formatting

| Option          | What it does                                                                                   |
| --------------- | ---------------------------------------------------------------------------------------------- |
| `stacked`       | Stacks bars, lines or areas instead of drawing them side by side                               |
| `orientation`   | Draws bars horizontally; the first category is on top                                          |
| `number_format` | Formats measures: fixed decimals, thousands grouping, a percentage or a compact form like 1.2K |
| `currency`      | Adds a currency, given as a three-letter ISO 4217 code such as `USD` or `EUR`                  |

A percentage format expects a ratio, so 0.25 is shown as 25%. The options apply to measures, not to the x axis or key columns. An option that does not apply to a chart type is ignored; for example, `stacked` has no effect on a pie.

## Limits that keep charts readable

- **Eight series at most.** The chart palette has eight colors. More series than that fold into one "Other" series, which is recomputed from the raw values.
- **Pie slices fold the same way,** and slices with no value are dropped. On a narrow screen the labels move out of the way and the legend names every slice.
- **Time axes** show month labels when every value is the first of a month, and day labels otherwise.

## Colors, themes and access

Charts take their colors from the same theme as the app, so they follow light and dark mode and redraw when you switch. Each chart has a text name, and its values are available in a table under it. Series keep their order of first appearance, so colors follow entities, not rank.

## Invalid specs

Chart specs are checked before anything is drawn. A spec that breaks a rule, such as a pie with two measures or a field that was never declared, is not drawn; the chart shows an error that names the rule. Charts that are valid still draw.

## Related

[Dashboards from a question](https://emolysis.com/docs/dashboards), [Sharing dashboards](https://emolysis.com/docs/sharing) and the [semantic model](https://emolysis.com/glossary/semantic-model) entry.

---

Page: https://emolysis.com/docs/chart-types. Emolysis is a product of Bandpey GmbH, Munich, Germany. It is in private development, and nothing is released yet.
