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

# Authoring charts

> Display a table-valued variable as a bar or pie chart, and configure its series, labels, and slices.

A chart is a **presentation of a [table](/authoring/tables)**, not a separate kind of value. You display a table variable as a chart by giving it the `bar_chart` or `pie_chart` display type (see [Defining variables](/authoring/defining-variables)). The variable's value stays a table — the chart only changes how that table is shown.

## Bar charts

A `bar_chart` plots the values of a table as bars. You configure:

* **Series orientation** — whether each series is a **column** or a **row** of the table. A schedule with a payment column and a balance column, plotted by column, becomes two series.
* **Stacking** — whether the series are drawn side by side or stacked into a single bar per group.
* **Labels** — where the bar labels come from: the row index, or the first series of the table, starting from a series index you set.
* **Series format** — for each series, a name, a display type, and a decimal format, the same scalar formatting a column uses.

## Pie charts

A `pie_chart` plots a table's values as slices of a whole. You configure:

* **Slice names** — optional labels for the slices.
* **Decimal format** — the precision applied to the values shown.

A pie chart is suited to parts of a single total — principal versus interest, a budget split across categories — where a bar chart is suited to comparing values across a series.

## Mixed units in a chart

When the column behind a chart holds values in **different units of the same dimension** — `3 ft`, `4 in`, and `5 yd` in one column, say — the chart draws every bar or slice to a single common unit, so their sizes are proportioned honestly rather than taken from the raw numbers. Each label and tooltip still shows the value's original unit, so the `4 in` bar reads `4 in` even though it is drawn on a `ft` axis. The common unit is the first cell's unit, and a pie chart's percentages are taken from those common-unit magnitudes. This needs no authoring action — a mixed-unit column charts correctly on its own.

To pin the axis to a particular unit instead of the first cell's, [cast](/math/units#casting-to-a-specific-unit) the column to that unit in the chart variable's equation; casting converts the data, so the labels then show the unit you chose.

If a column instead mixes **different dimensions** — a length and a mass, say — there is no common axis to draw against, so the chart shows a short message naming the conflicting unit types rather than a misleading chart. Keep a chart's column to a single dimension.

## The chart is a view of the table

Because a chart is display configuration over a table, the data behind it is authored, supplied, and returned as a table in every case: you build it from a [table variable](/authoring/tables), users provide its values through [structured-text input](/concepts/input-formats#tables), and a calculation returns it as a table in the [result](/api/calculate). Choosing a chart over a grid is purely a presentation decision — the math is unchanged.
