---
title: Show data in a line chart
project: UI Builder
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/uibuilder/1-0/recipes/line-chart/
updated: 2026-11-19T08:01:47.531Z
---

# Show data in a line chart

> Feed a line chart with sample data from a Data generator on a dashboard.

This recipe puts a line chart on a dashboard and fills it with sample data, so you can see the chart before real data is connected.

## Build the dashboard

**1.** On the start screen, select **Dashboard**. Type `Demo project` in **Name** and select **SUBMIT**.

**2.** Right-click the **Columns** label and choose **Remove**: this example does not need columns.

**3.** Drag **Data generator** into the **Container**. Open its settings, set **Name** to `Visitors data` and type this data in the code editor:

```json
[
	{
		"name": "Visitors",
		"unit": "visits",
		"data": [
			{ "x": "2026-11-01", "y": 120 },
			{ "x": "2026-11-02", "y": 180 },
			{ "x": "2026-11-03", "y": 150 },
			{ "x": "2026-11-04", "y": 210 },
			{ "x": "2026-11-05", "y": 240 }
		]
	}
]
```

Select **SUBMIT**.

**4.** Drag **Line chart** under the data generator. Open its settings, set **Name** to `Visitors` and, in **Read value from**, pick the **Visitors data** component. Select **SUBMIT**.

In the editor, the chart shows a grey sample shape.

![The data generator and the line chart in the editor](/files/JapWtN38N61f.webp)

## See the chart

Select **Publish**, then **Download HTML**, confirm with **PUBLISH** and open the downloaded file. The chart draws your data.

![The published line chart with the sample data](/files/JapWtP39N60f.webp)

## The data format

A line chart reads a list of series. Each series has a `name`, a list `data` of points with `x` (a date) and `y` (a number), and optionally a `unit` and `decimals`. Other chart components describe their format in **Read information**.

When your real data is ready, replace the **Data generator** with a component that reads it, for example **REST Reader**, and point the chart to it.
