[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationChart card

Chart card

A framed chart with its headline value, variation and comparison legend. Use it on a dashboard instead of a bare chart.

ChartCard wraps one chart in a card and surfaces the metric around it: a title with an optional icon and description, a large formatted headline value with its delta badge versus the comparison period, an optional primary / comparison legend, and the chart filling the body. The card owns the data; the nested chart only says how to draw it.

Chart card ChartCard
Connecting to the DMS preview…
Connecting DMS 0.25.8 8 options set
Note

A chart card reads its series from fetchUrl. This preview uses fixed sales data from the preview service, without a playground module or access to your application's data. If the live renderer is unavailable, the documentation shows a static screenshot instead.

Usage

src/pages/sales.ts ts
import { ChartCard } from "@antelopejs/interface-dms/base/chart-card";
import { ChartArea } from "@antelopejs/interface-dms/base/chart";

static trend = ChartCard({
  title: "$shop.sales.trend",
  fetchUrl: "/api/sales/series",
  periodScope: "sales",
  valueFormat: "currency",
  currencyCode: "EUR",
  chart: ChartArea({ smooth: true, comparisonStyle: "dashed", xaxisType: "datetime" }),
});

The route answers the headline and the series:

src/pages/sales.ts ts
@Get("series")
series() {
  return {
    value: 48200,
    delta: 12.4,
    previousValue: 42900,
    series: [{ name: "$shop.sales.revenue", data: [{ x: "2026-10-01", y: 4200 }, { x: "2026-10-02", y: 4800 }] }],
    comparisonSeries: [{ name: "$shop.sales.previous", data: [{ x: "2026-10-01", y: 3900 }, { x: "2026-10-02", y: 4100 }] }],
  };
}

Each series name, each category x and each point label follow the $-prefix convention: a $ key is translated in the browser, in the language on screen, and reaches the legend, the axis, the slices, the tooltip and the POINT_CLICK payload translated. A date, a number or a string without the $ is drawn as sent.

Options

Options of the Chart card block
OptionTypeDefaultDescription
title* Contentstring–Card heading.
description Contentstring–
primaryLabel Contentstring–
comparisonLabel Contentstring–
icon Appearancestring–
valueFormat Appearance"number" | "currency" | "percent" | "compact"–
currencyCode Appearancestring–
showDelta Appearancebooleantrue
showLegend Appearancebooleantrue
showSeriesLegend Appearanceboolean–Name each series of the chart.
invert Behaviorboolean–Treat a falling value as the good outcome.

The card supplies its chart's title, description, showLegend, fetchUrl, fetchUrlMethod, periodScope and realtimeTopic; set presentation options on the chart instead (smooth, comparisonStyle, xaxisType, height, legendPosition). valuePrecision is available in code (Value precision).

Recipes

Name several series

A card plotting several series ("Average", "Max", "p95") names them with showSeriesLegend: true, placed by the chart's legendPosition:

src/pages/routes.ts ts
import { ChartCard } from "@antelopejs/interface-dms/base/chart-card";
import { ChartLine } from "@antelopejs/interface-dms/base/chart";

ChartCard({
  title: "$api.routes.response_time",
  fetchUrl: "/api/routes/latency",
  showSeriesLegend: true,
  chart: ChartLine({ color: ["info", "neutral", "secondary"], legendPosition: "top" }),
});

A metric where lower is better

invert: true reads a fall as the good outcome, as on a KpiCard or a TopListCard: an error rate or a latency going up shows its delta in the error colour, going down in the success colour. The arrow still follows the raw direction.

src/pages/api.ts ts
import { ChartCard } from "@antelopejs/interface-dms/base/chart-card";
import { ChartLine } from "@antelopejs/interface-dms/base/chart";

ChartCard({ title: "$api.errors.rate", fetchUrl: "/api/errors/rate", valueFormat: "percent", invert: true, chart: ChartLine() });

Refresh on events

realtimeTopic makes the card read its route again on each event published there, keeping what it shows meanwhile. On a page declared with live, it reads at most once per maxRate.

Follow the selected comparison

With a periodScope, the card follows the comparison its PeriodSelector applies. The legend names the comparison series after it ("Previous period", "Previous year"; "Comparison" for a custom window) unless comparisonLabel names it, and the headline prints previousValue as "vs €42,900", formatted as the value. With "No comparison" selected, the card draws no change, no "vs" figure and no comparison series, whatever the route answers.

Pitfalls

  • Never pass a raw ApexCharts legend through rawOptions to name series: use showSeriesLegend.
  • Without realtimeTopic, a card bound to a rolling period only moves when the period does.

Next steps

Charts

Pick the chart the card wraps.

KPI card

The headline without the chart.