Skip to content
Web > Charts

Charts That Update Live

Known issues

Some chart features have known issues in the current release. See Known issues.

This page covers making a chart update live as rows change in the Center table it reads.

Overview

A chart draws its datamodel's latest output. What makes it redraw is what makes the datamodel run:

Datamodel Reruns The chart
Runs on startup, the gallery's default ("Auto-Run:" "On Startup") Once, when the layout opens Shows the rows from that run, and does not change when the table does
Subscribed to a Center table On every insert, update, or delete in the table Redraws within about a second of each change

A datamodel created by the gallery from a table runs on startup, so its chart does not change when the table does until the datamodel is subscribed. Datamodel run modes and subscriptions are covered in the Datamodels section; this page covers what they mean for a chart.

Making a chart update live

Subscribing the chart's datamodel to its Center table makes the datamodel rerun on every change.

  1. In Editor mode, select the chart's edit button, then Edit Underlying Datamodel... and the datamodel's name. The "Edit Datamodel" window opens.
  2. Select the "Subscribe:" field. A list of feeds opens, one per Center table, such as FEED:Trades.
  3. Select the checkbox of the chart's table, then select outside the list. The field shows the feed.
  4. Select "Finish".
  5. Insert a row into the table, such as with the AMIDB Shell Tool.
  6. Check that the chart redraws with the new row within about a second.

The search box at the top of the list does not find a feed by its name; scroll the list instead.

Over MCP, the same subscription is the datamodel's subscribe list, with the table's name after FEED::

{"id": "TradesLive", "queryMode": "startup", "subscribe": ["FEED:Trades"], "callbacks": [{"name": "onProcess", "amiscript": ["{ CREATE TABLE T AS USE ds=\"AMI\" EXECUTE SELECT * FROM Trades; }"]}]}

A subscribed datamodel's schema lists the feed as a second table, FEED:Trades, beside its output table. Chart the output table, T here, not the feed.

What a live chart does

When the subscribed datamodel reruns, the chart redraws from its new output:

  • An insert: the chart adds a bar, point, or slice for the new row.
  • An update: the chart redraws the changed row's shape with its new values.
  • A delete: the chart removes the row's shape.
  • A new range of values: an axis on automatic range widens or narrows to fit the new values, such as a value axis growing from 0-40 to 0-100 when a value of 99 arrives.