LLM-friendly URL

Rendering charts from inline data

A Flex chart normally queries a Luzmo dataset. With the inlineData property, you pass the chart its data points directly instead, and it renders them with no dataset or query.

Use inline data when the data you want to show doesn't live in Luzmo, for example:

  • results from your own API or database

  • the answer of an AI agent or an MCP tool

  • a chart preview before your data is connected to Luzmo

  • a small, fixed set of values

Inline data is supported from these package versions:

  • @luzmo/embed 8.1.0

  • @luzmo/ngx-embed 10.1.0

  • @luzmo/react-embed 8.1.0

  • @luzmo/vue-embed 8.1.0

  • @luzmo/react-native-embed 7.1.0

How it works

You set three properties on the viz item:

  • type : the chart type, as usual.

  • slots : each slot content item names a record property with field , instead of pointing to a dataset column with datasetId and columnId .

  • inlineData : an object that holds the records.

The chart doesn't send a query, so you don't need an authKey or authToken .

The inlineData object has these properties:

Property Type Description
records array Required. One object per data point. Each slot field refers to a property of these objects.
sourceDescription string Optional. Describes where the records come from, for example "Top products from the sales API" .
topojson object Optional. TopoJSON shapes for map charts.

To change the data, assign a new inlineData object. The chart re-renders with the new records.

To make the chart query a dataset again, set inlineData to null . The chart then needs everything a dataset-backed chart needs: slot content items that point to dataset columns with datasetId and columnId , and an authKey and authToken . If you configured the chart with field slots and no authorization, as in the examples below, set those as well.

Data format

Each record value must match the type of the slot content item that refers to it:

Slot type Record value Example
numeric A number. 1840
hierarchy An object with an id and a name . The name is a string or an object with a value per locale. Add an optional color to set the color of that category. { "id": "eu", "name": { "en": "Europe" } }
datetime An ISO 8601 date string. Set level on the slot content item to choose the granularity, for example 3 for months or 5 for days. "2026-11-02T00:00:00.000Z"

A missing property or a null value counts as an empty value.

⚠️

Always pass hierarchy values as { id, name } objects. Plain strings don't render correctly.

The slot content items still accept label and format , the same as for dataset-backed charts. Below, a record and the slots that use it:

inline-data-format.json
json
{
  "slots": [
    {
      "name": "x-axis",
      "content": [{ "field": "region", "type": "hierarchy", "label": { "en": "Region" } }]
    },
    {
      "name": "measure",
      "content": [{ "field": "revenue", "type": "numeric", "label": { "en": "Revenue" }, "format": "$,.0f" }]
    }
  ],
  "inlineData": {
    "sourceDescription": "Revenue per region from the finance API",
    "records": [
      { "region": { "id": "eu", "name": { "en": "Europe" } }, "revenue": 310000 }
    ]
  }
}

Limitations

Inline data skips Luzmo's query engine, so features that run there don't apply.

  • Records are final results. Luzmo doesn't aggregate, sort, rank, limit or filter them. Send one record per data point, already summed or averaged the way you want to show it. Axis categories follow the order of your records.

  • Your application decides what data to show. Filters in your embed token apply to Luzmo datasets, not to inline data. Pass the records the current user should see, as you would anywhere else in your application.

  • No interaction with other items. Clicking or selecting data in the chart doesn't filter other Flex items, and filters from other items don't apply to it.

  • Size. The inlineData object can be at most 2 MB as JSON.

  • Field names. Every slot content item needs a field , and each field can be used only once across all slots.

  • Chart types. Inline data works for all chart types except tables ( regular-table , pivot-table ), filter items ( date-filter , date-comparison-filter , dropdown-filter , search-filter , slicer-filter , slider-filter ), venn-diagram and custom charts.

  • Viz item only. The dashboard component ( luzmo-embed-dashboard ) doesn't accept inline data.

If the data doesn't meet these rules, the chart shows an error message instead of the data, for example "Records must be an array of objects".

Examples

Column chart: revenue by region and quarter

This example shows quarterly revenue per sales region as a grouped column chart. The slots, options and records live in one file that each framework imports.

revenue-by-region.js
javascript
const region = (id, name) => ({ id, name: { en: name } });
const quarter = (id) => ({ id, name: { en: id } });

export const slots = [
  {
    name: 'x-axis',
    content: [{ field: 'quarter', type: 'hierarchy', label: { en: 'Quarter' } }]
  },
  {
    name: 'legend',
    content: [{ field: 'region', type: 'hierarchy', label: { en: 'Region' } }]
  },
  {
    name: 'measure',
    content: [{ field: 'revenue', type: 'numeric', label: { en: 'Revenue' }, format: '$,.0f' }]
  }
];

export const options = {
  title: { en: 'Revenue by region and quarter' },
  display: { title: true }
};

export const inlineData = {
  sourceDescription: 'Quarterly revenue from the finance API',
  records: [
    { quarter: quarter('Q1'), region: region('na', 'North America'), revenue: 420000 },
    { quarter: quarter('Q1'), region: region('eu', 'Europe'), revenue: 310000 },
    { quarter: quarter('Q1'), region: region('apac', 'Asia Pacific'), revenue: 180000 },
    { quarter: quarter('Q2'), region: region('na', 'North America'), revenue: 465000 },
    { quarter: quarter('Q2'), region: region('eu', 'Europe'), revenue: 342000 },
    { quarter: quarter('Q2'), region: region('apac', 'Asia Pacific'), revenue: 205000 },
    { quarter: quarter('Q3'), region: region('na', 'North America'), revenue: 448000 },
    { quarter: quarter('Q3'), region: region('eu', 'Europe'), revenue: 365000 },
    { quarter: quarter('Q3'), region: region('apac', 'Asia Pacific'), revenue: 238000 },
    { quarter: quarter('Q4'), region: region('na', 'North America'), revenue: 512000 },
    { quarter: quarter('Q4'), region: region('eu', 'Europe'), revenue: 398000 },
    { quarter: quarter('Q4'), region: region('apac', 'Asia Pacific'), revenue: 261000 }
  ]
};
index.html
Web component
Angular
React
React Native
Vue
<div style="height: 400px">
  <luzmo-embed-viz-item id="revenue-chart" type="column-chart"></luzmo-embed-viz-item>
</div>
<script type="module" src="./index.js"></script>
index.js
Web component
Angular
React
React Native
Vue
import '@luzmo/embed';
import { slots, options, inlineData } from './revenue-by-region.js';

const chart = document.querySelector('#revenue-chart');
chart.slots = slots;
chart.options = options;
chart.inlineData = inlineData;
ℹ️

The remaining examples use the web component. Each one includes the HTML element its script selects. In the framework wrappers, you pass the same objects to the inlineData , slots and options inputs, as in the first example.

Line chart: daily active users

This example shows daily active users over two weeks. The dates are ISO strings, and level: 5 on the slot shows them per day.

index.html
html
<div style="height: 400px">
  <luzmo-embed-viz-item id="active-users-chart" type="line-chart"></luzmo-embed-viz-item>
</div>
<script type="module" src="./daily-active-users.js"></script>
daily-active-users.js
javascript
import '@luzmo/embed';

const chart = document.querySelector('#active-users-chart');

chart.slots = [
  {
    name: 'x-axis',
    content: [{ field: 'date', type: 'datetime', level: 5, label: { en: 'Date' } }]
  },
  {
    name: 'measure',
    content: [{ field: 'activeUsers', type: 'numeric', label: { en: 'Daily active users' }, format: ',.0f' }]
  }
];

chart.options = { title: { en: 'Daily active users' }, display: { title: true } };

chart.inlineData = {
  sourceDescription: 'Product analytics export',
  records: [
    { date: '2026-11-02T00:00:00.000Z', activeUsers: 1240 },
    { date: '2026-11-03T00:00:00.000Z', activeUsers: 1310 },
    { date: '2026-11-04T00:00:00.000Z', activeUsers: 1295 },
    { date: '2026-11-05T00:00:00.000Z', activeUsers: 1380 },
    { date: '2026-11-06T00:00:00.000Z', activeUsers: 1420 },
    { date: '2026-11-07T00:00:00.000Z', activeUsers: 980 },
    { date: '2026-11-08T00:00:00.000Z', activeUsers: 910 },
    { date: '2026-11-09T00:00:00.000Z', activeUsers: 1450 },
    { date: '2026-11-10T00:00:00.000Z', activeUsers: 1510 },
    { date: '2026-11-11T00:00:00.000Z', activeUsers: 1490 },
    { date: '2026-11-12T00:00:00.000Z', activeUsers: 1560 },
    { date: '2026-11-13T00:00:00.000Z', activeUsers: 1605 },
    { date: '2026-11-14T00:00:00.000Z', activeUsers: 1050 },
    { date: '2026-11-15T00:00:00.000Z', activeUsers: 990 }
  ]
};

Donut chart: support tickets by priority

This example shows open support tickets per priority. Each priority sets its own color , so urgent tickets always show in red.

index.html
html
<div style="height: 400px">
  <luzmo-embed-viz-item id="tickets-chart" type="donut-chart"></luzmo-embed-viz-item>
</div>
<script type="module" src="./tickets-by-priority.js"></script>
tickets-by-priority.js
javascript
import '@luzmo/embed';

const chart = document.querySelector('#tickets-chart');

chart.slots = [
  {
    name: 'category',
    content: [{ field: 'priority', type: 'hierarchy', label: { en: 'Priority' } }]
  },
  {
    name: 'measure',
    content: [{ field: 'tickets', type: 'numeric', label: { en: 'Open tickets' }, format: ',.0f' }]
  }
];

chart.options = { title: { en: 'Open support tickets by priority' }, display: { title: true } };

chart.inlineData = {
  sourceDescription: 'Open tickets from the helpdesk API',
  records: [
    { priority: { id: 'urgent', name: { en: 'Urgent' }, color: '#d64545' }, tickets: 12 },
    { priority: { id: 'high', name: { en: 'High' }, color: '#f08c2e' }, tickets: 37 },
    { priority: { id: 'normal', name: { en: 'Normal' }, color: '#3f7fd9' }, tickets: 85 },
    { priority: { id: 'low', name: { en: 'Low' }, color: '#9aa5b1' }, tickets: 41 }
  ]
};

Updating a chart at runtime

This example shows the best-selling products for the period picked in a <select id="period-picker"> . Each time the period changes, it fetches new results from your own API and replaces the chart's records. /api/top-products stands for your own backend endpoint, which returns rows like { "product": "Trail running shoes", "unitsSold": 1840 } .

In the preview below, pick another period to replace the chart's records.

Period
index.html
html
<select id="period-picker">
  <option value="last-month">Last month</option>
  <option value="this-week">This week</option>
</select>
<div style="height: 400px">
  <luzmo-embed-viz-item id="top-products-chart" type="bar-chart"></luzmo-embed-viz-item>
</div>
<script type="module" src="./top-products-chart.js"></script>
top-products-chart.js
javascript
import '@luzmo/embed';

const chart = document.querySelector('#top-products-chart');

chart.slots = [
  {
    name: 'y-axis',
    content: [{ field: 'product', type: 'hierarchy', label: { en: 'Product' } }]
  },
  {
    name: 'measure',
    content: [{ field: 'unitsSold', type: 'numeric', label: { en: 'Units sold' }, format: ',.0f' }]
  }
];

async function showTopProducts(period, title) {
  const response = await fetch(`/api/top-products?period=${period}`);
  const rows = await response.json();

  chart.options = { title: { en: title }, display: { title: true } };
  chart.inlineData = {
    sourceDescription: `Top products from the sales API (${period})`,
    records: rows.map((row) => ({
      product: { id: row.product, name: row.product },
      unitsSold: row.unitsSold
    }))
  };
}

showTopProducts('last-month', 'Best-selling products last month');

document.querySelector('#period-picker').addEventListener('change', (event) => {
  const option = event.target.selectedOptions[0];
  showTopProducts(option.value, `Best-selling products ${option.text.toLowerCase()}`);
});
Did this page help you?
Yes No