Chart
Draws the rows of a list operation as bars, stacked bars, a line or a donut.
Use it for: Showing totals a database view worked out: spending by category, sales by month. x names the category or date field, y the number, and series the field that splits bars into stacks, lines or slices. format shapes the numbers like a Text does. Ynch doesn’t add things up; a view does.
- CategoryData
- ChildrenNone
- DataA list operation (bindings.items)
- ActionNone
| Prop | Required | Accepts | What it does |
|---|---|---|---|
kind |
Yes | bar, stacked-bar, line, donut |
|
x |
Yes | text in a fixed format | |
y |
Yes | text in a fixed format | |
series |
No | text in a fixed format | |
format |
No | text | |
height |
No | sm, md, lg |
How tall it is: sm 120, md 200, lg 280, xl 360 points. |
emptyText |
Yes | text, up to 200 characters | Shown when there are no rows. |
title |
Yes | text, up to 200 characters | Shown in the navigation bar. |
Every component also accepts id (required, unique on its screen), and the optional preset and style described in Style options. Every component except Screen accepts when, described in Data-driven look.
Example
Section titled “Example”From the Northline Builders example project:
{ "id": "category-chart", "type": "Chart", "props": { "kind": "donut", "y": "total", "format": { "style": "currency", "currency": "USD", "decimals": 0 }, "title": "Spending by category", "emptyText": "No expenses yet.", "x": "category" }, "bindings": { "items": { "operationId": "list-spend-by-category", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 20 } } }}