Widgets
Which widget fits a dashboard card depends on the shape of its query result. In version 2.0, the widgets include key metrics, supported charts, tables, filters, date filters and text. There is no Image widget. You configure a widget in the Widget Settings dialog or in code, with the fields it aggregates, its appearance and the interactions it allows.
Configure a Widget Visually
Select a card in design mode and open Widget Settings. Choose the visualization and assign its source and fields. Inspect the preview before you choose Apply. A Region dimension with a Revenue measure and the SUM aggregation creates one total per region:

The settings dialog groups data, text, card and title, chart appearance and number display into expandable categories. Use them to refine the typography, the card and title appearance, the number display and the chart interactions:

Widget Settings Dialog explains each category and also shows how to configure a date filter.
Choose Fields and Aggregations
Dimensions group rows. Measures aggregate numeric fields or counts. The supported aggregation names, listed by the TypeScript type AnalyticsAggregation, include SUM, COUNT, COUNT DISTINCT, AVG, MIN and MAX. COUNT without a field can count rows; distinguish that from counting the nonblank values in a field.
The following code adds a bar chart of the revenue per region to the dashboard and the source sales of Creating Dashboards:
dashboard.addWidget({
id: 'regions', type: 'bar', title: 'Revenue by region',
placement: { x: 0, y: 2, width: 8, height: 4 },
query: { sourceId: 'sales', dimensions: ['Region'], measures: [
{ field: 'Revenue', aggregation: 'SUM', alias: 'Revenue' }
] },
appearance: { chartColors: ['#1b6280', '#ed762b', '#247945'], animation: true },
interactions: { filter: true, allowSourceData: false }
});
The code works as follows:
- Dashboard.addWidget adds a bar chart (
type: 'bar') with the IDregionsand the titleRevenue by region. The object it takes is a widget definition, described by the TypeScript interface DashboardWidget. placementpositions the card on the grid of the dashboard.querygroups the records of the sourcesalesby theRegiondimension and sums theRevenuefield for each region.appearancesets three chart colors as six-digit hex values and turns on the animation.interactionsenables filter interactions and keeps source-data access off (allowSourceData: false).
Set the Presentation
The appearance model of a widget supports these settings:
- Text: font family and size, emphasis, alignment and text color.
- Card and title: title color, background, border and title visibility.
- Charts: chart palettes, legends, data labels and animation.
Omitted settings inherit defaults. Colors are six-digit hex values, and the documented font sizes use points.
Number-display options format KPI values, table values, labels and tooltips. Currency, accounting and grouping are presentation choices: they do not redefine the aggregation of the query. Use the same measurement units across a comparison.
Update, Move and Remove Widgets
In design mode, choose the trash button on a widget to remove it. Press Ctrl+Z immediately to restore the complete widget, including its settings and placement; Ctrl+Y reapplies the removal.
Widget IDs are unique within a dashboard. Update a widget through dashboard.updateWidget and remove it through dashboard.removeWidget, both by its ID:
- Dashboard.updateWidget changes the settings you pass and keeps the identity of the widget.
- Dashboard.removeWidget removes the widget in one undoable edit.
Moving or resizing a widget reserves the requested geometry and relocates collisions in the same supported transaction. The animation is quick and respects reduced-motion preferences.
Decide What Readers Can Do
Enable filter interactions and source-data access deliberately, and use Filters and Drill-Down together with the authorization of your host application.
Important
Source Rows. A chart that permits source rows can reveal more detail than a summary metric.
Choose an Advanced Chart
Chart families consume grouped query results. Add the required dimensions and measures in Analysis & Measures; selecting a chart does not invent the underlying business calculation.
| Chart type | Query and purpose |
|---|---|
column, bar | One category dimension and one or more numeric measures; compare groups. |
bar-stacked, column-stacked | Multiple measure aliases stacked per category; show additive components. |
bar-percent, column-percent | Normalize positive and negative components separately; values are displayed as shares. |
line, area, area-stacked, area-percent | Ordered categories, usually grouped dates; show trends and composition over time. |
combo | Columns on the primary axis and the selected secondaryMeasure as a line with a secondary scale. |
waterfall | Ordered signed contributions; categories named in chart.totals restart from zero as absolute totals. |
bullet | A value per category, optional performance bands and a target marker. |
heatmap | Two dimensions and a numeric measure; intensity compares intersections. |
scatter, bubble | Numeric X/Y aliases; bubbles use a third numeric size alias. Include a dimension to identify observations. |
treemap | Positive weights per category; rectangle areas compare composition. |
small-multiples | A category dimension and a panel dimension selected by panelField; up to 12 panels. |
box-plot | Category plus an observation identifier, with one numeric measure; quartiles, median, 1.5-IQR whiskers and outliers. |
histogram | Individual numeric observations; use a unique observation dimension to avoid aggregating them away. bins selects 1–100 bins. |
map | Region keys and a numeric measure joined to application-supplied Polygon/MultiPolygon geometry. |
pie, donut | Category shares using the existing chart appearance and legend controls. |

Maps work offline and do not fetch tiles or region boundaries. Supply longitude/latitude rings through chart.mapFeatures, or import a GeoJSON FeatureCollection in Map Geometry. The region key must match the query dimension. The sample's rectangular regional geometry is illustrative. Geometry is stored in TXWB and exported with the dashboard.
Compare KPI Values and Targets
KPI settings select the displayed measure, a comparison measure or query, a previous calendar period, a target, a trend query and conditional thresholds. A previous-period comparison requires an active date filter for its configured field; it does not guess the reporting period from today's date.
dashboard.addWidget({
id: 'profit', type: 'kpi', title: 'Profit Against Last Year',
placement: { x: 0, y: 0, width: 4, height: 5 },
query: { sourceId: 'sales', measures: [
{ field: 'Profit', aggregation: 'SUM', alias: 'Profit' }
] },
format: { style: 'currency', currency: 'USD', maximumFractionDigits: 0 },
kpi: {
measure: 'Profit', target: 150000,
comparisonPeriod: { field: 'Date', unit: 'year' },
positiveIsGood: true,
trendQuery: { sourceId: 'sales', dimensions: ['Date'],
dateGrouping: [{ field: 'Date', unit: 'month' }],
measures: [{ field: 'Profit', aggregation: 'SUM', alias: 'Profit' }],
sort: { field: 'Date' } },
thresholds: [{ maximum: 100000, color: '#C63D57' }]
}
});
dashboard.setFilters([{ sourceId: 'sales', field: 'Date', operator: 'between',
values: ['2026-01-01', '2026-12-31'], dateGranularity: 'day' }]);
The card calculates the same period one year earlier, absolute change and percentage change, then draws the trend and target progress. Percentage change is null when the comparison is zero or missing. For a cost metric, use positiveIsGood: false. dashboard.kpi('profit') returns the detached values for your application UI.
Next Steps
- Widget Settings Dialog: configure each category of a widget, including date filters.
- Filters and Drill-Down: let chart selections and filter widgets narrow the other widgets.
- Dashboard Designer and Viewer: use the dashboard UI to arrange the cards and explore them in view mode.