> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/sdk-dv-ui/getting-started/readme.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Introduction

Dashboards of charts, tables and stats, fed by your Rierino APIs.

A data visualization is a dashboard stored in Rierino: a layout of components such as charts, stats, lists and tables, plus the APIs that provide their data. `@rierino-open/dv` is the renderer that shows them. The Rierino admin UI uses it for its dashboards and its data visualization widgets, and you can use it to show the same dashboards in your own React app.

{% tabs %}
{% tab title="Definition" %}

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {}, "refresh": 0 }],
  "layout": {
    "type": "RCol",
    "items": [
      {
        "type": "RGrid",
        "props": { "cols": 3 },
        "items": [
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(revenue) AS [value], 0.12 AS trend FROM orders WHERE [month] = '2026-12'"
                },
                "props": {
                  "title": "Revenue this month",
                  "icon": "value",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": {
                    "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
                  }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(orders) AS [value], -0.03 AS trend FROM orders WHERE [month] = '2026-12'"
                },
                "props": {
                  "title": "Orders this month",
                  "icon": "quantity",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": { "options": { "maximumFractionDigits": 0 } }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(revenue) / SUM(orders) AS [value], 0 AS trend FROM orders"
                },
                "props": {
                  "title": "Average order",
                  "icon": "average",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": {
                    "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "type": "RGrid",
        "props": { "cols": 3 },
        "items": [
          {
            "type": "RCard",
            "props": {
              "title": "Revenue by month",
              "classes": { "rootExtra": "relative h-72 col-span-2" }
            },
            "items": [
              {
                "type": "RECharts",
                "bind": {
                  "query": "SELECT [month], SUM(revenue) AS revenue FROM orders GROUP BY [month] ORDER BY [month]"
                },
                "props": {
                  "style": { "height": 230 },
                  "option": {
                    "grid": { "left": 48, "right": 8, "top": 16, "bottom": 24 },
                    "xAxis": { "show": true, "type": "category" },
                    "yAxis": { "show": true },
                    "tooltip": { "show": true, "trigger": "axis" },
                    "series": [
                      {
                        "type": "bar",
                        "encode": { "x": "month", "y": "revenue" },
                        "itemStyle": { "color": "#9a42ff" }
                      }
                    ]
                  }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "title": "Top cities", "classes": { "rootExtra": "relative h-72" } },
            "items": [
              {
                "type": "RList",
                "bind": {
                  "query": "SELECT city, SUM(revenue) AS revenue FROM orders GROUP BY city ORDER BY revenue DESC"
                },
                "props": {
                  "icon": "●",
                  "nameField": "city",
                  "valueField": "revenue",
                  "valueFormat": {
                    "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
                  }
                }
              }
            ]
          }
        ]
      }
    ]
  }
}
```

{% endtab %}

{% tab title="Sample data" %}
The rows the dashboard's sources return.

`orders` (30 rows)

```json
[
  { "month": "2026-07", "city": "Boston", "region": "North", "orders": 40, "revenue": 3200 },
  { "month": "2026-07", "city": "Chicago", "region": "North", "orders": 53, "revenue": 3777 },
  { "month": "2026-07", "city": "Austin", "region": "South", "orders": 41, "revenue": 4354 },
  { "month": "2026-07", "city": "Miami", "region": "South", "orders": 54, "revenue": 4931 },
  { "month": "2026-07", "city": "Denver", "region": "West", "orders": 42, "revenue": 5508 },
  { "month": "2026-08", "city": "Boston", "region": "North", "orders": 47, "revenue": 4291 },
  { "month": "2026-08", "city": "Chicago", "region": "North", "orders": 60, "revenue": 4868 },
  { "month": "2026-08", "city": "Austin", "region": "South", "orders": 48, "revenue": 5445 },
  { "month": "2026-08", "city": "Miami", "region": "South", "orders": 61, "revenue": 3622 },
  { "month": "2026-08", "city": "Denver", "region": "West", "orders": 49, "revenue": 4199 },
  { "month": "2026-09", "city": "Boston", "region": "North", "orders": 54, "revenue": 5382 },
  { "month": "2026-09", "city": "Chicago", "region": "North", "orders": 42, "revenue": 5959 },
  { "month": "2026-09", "city": "Austin", "region": "South", "orders": 55, "revenue": 4136 },
  { "month": "2026-09", "city": "Miami", "region": "South", "orders": 43, "revenue": 4713 },
  { "month": "2026-09", "city": "Denver", "region": "West", "orders": 56, "revenue": 5290 },
  { "month": "2026-10", "city": "Boston", "region": "North", "orders": 61, "revenue": 4073 },
  { "month": "2026-10", "city": "Chicago", "region": "North", "orders": 49, "revenue": 4650 },
  { "month": "2026-10", "city": "Austin", "region": "South", "orders": 62, "revenue": 5227 },
  { "month": "2026-10", "city": "Miami", "region": "South", "orders": 50, "revenue": 5804 },
  { "month": "2026-10", "city": "Denver", "region": "West", "orders": 63, "revenue": 3981 },
  { "month": "2026-11", "city": "Boston", "region": "North", "orders": 43, "revenue": 5164 },
  { "month": "2026-11", "city": "Chicago", "region": "North", "orders": 56, "revenue": 5741 },
  { "month": "2026-11", "city": "Austin", "region": "South", "orders": 44, "revenue": 6318 },
  { "month": "2026-11", "city": "Miami", "region": "South", "orders": 57, "revenue": 4495 },
  { "month": "2026-11", "city": "Denver", "region": "West", "orders": 45, "revenue": 5072 },
  { "month": "2026-12", "city": "Boston", "region": "North", "orders": 50, "revenue": 6255 },
  { "month": "2026-12", "city": "Chicago", "region": "North", "orders": 63, "revenue": 4432 },
  { "month": "2026-12", "city": "Austin", "region": "South", "orders": 51, "revenue": 5009 },
  { "month": "2026-12", "city": "Miami", "region": "South", "orders": 64, "revenue": 5586 },
  { "month": "2026-12", "city": "Denver", "region": "West", "orders": 52, "revenue": 6163 }
]
```

{% endtab %}

{% tab title="Code" %}
{% code title="getting-started/dashboard.tsx" %}

```tsx
import { Dashboard } from "@rierino-open/dv";
// the client from createClient(), set up in the Quick start
import { client } from "@/lib/rierino";

export default function StoreOverview() {
  return <Dashboard client={client} id="store-overview" />;
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Two ways to use it

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>In Rierino</strong></td><td>Design dashboards in the Data Science app and show them on any screen or inside a UI design. Nothing to install.</td><td><a href="https://docs.rierino.com/sdk-dv-ui/getting-started/in-rierino.md">Dashboards in Rierino</a></td></tr><tr><td><strong>In your own app</strong></td><td>Show a dashboard by its id in any React 18 app, with <code>@rierino-open/dv</code> and <code>@rierino-open/api-client</code>.</td><td><a href="https://docs.rierino.com/sdk-dv-ui/getting-started/installation.md">Installation</a></td></tr></tbody></table>

Both show the same definition, so a dashboard you design in Rierino looks and behaves the same in your app.

## How a dashboard works

A dashboard definition has two parts:

* **Sources**: the APIs that provide data. Each source has a `key`, which becomes the name of a table the components can query.
* **Layout**: a tree of components. Each one has a `type`, its `props`, and an optional `bind.query`: an [AlaSQL](https://github.com/AlaSQL/alasql) statement that picks its data from the source tables.

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RCard",
    "props": { "title": "Top cities" },
    "items": [
      {
        "type": "RList",
        "bind": {
          "query": "SELECT city, SUM(revenue) AS revenue FROM orders GROUP BY city ORDER BY revenue DESC"
        },
        "props": { "nameField": "city", "valueField": "revenue" }
      }
    ]
  }
}
```

When a dashboard opens, it loads each source once, keeps the rows in an in-browser database and runs every component's query against it. A source can also reload on a timer, and filters you pass to the dashboard are sent with every source request.

## Components

The components come in two groups. Layout components hold other components in their `items`; content components show data.

| Group  | Components                                                                                                                                                                                                                             |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Layout | Container, Row, Column, Grid, Section, Card, Loop, Empty                                                                                                                                                                               |
| Values | Label, Annotation, Icon Stat, List, Hint, Donut Percent, Line Percent                                                                                                                                                                  |
| Tables | Table, Pivot Table                                                                                                                                                                                                                     |
| Charts | E-Charts ([Apache ECharts](https://echarts.apache.org/) options), Plotly ([Plotly](https://plotly.com/javascript/) configuration), and ready-made Plotly charts: Bar Chart, Stack Bar, Bar-Scatter, Pie Chart, Tree Map and Choropleth |

Each component starts from a built-in template that sets its look, so a definition only has to give what is specific to it, such as which fields to show.

## Where to go next

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Dashboards in Rierino</strong></td><td>Design a dashboard and show it on a screen or in a UI design.</td><td><a href="https://docs.rierino.com/sdk-dv-ui/getting-started/in-rierino.md">Dashboards in Rierino</a></td></tr><tr><td><strong>Quick start</strong></td><td>Show a Rierino dashboard in your own React app.</td><td><a href="https://docs.rierino.com/sdk-dv-ui/getting-started/quick-start.md">Quick start</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rierino.com/sdk-dv-ui/getting-started/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
