TX Sheet Control

Widgets

Topic

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:

Widget Settings connecting Region and Revenue to a regional bar-chart preview with SUM aggregation

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:

Chart Appearance settings with Colorful and Monochromatic palettes and a persistent chart preview

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 ID regions and the title Revenue by region. The object it takes is a widget definition, described by the TypeScript interface DashboardWidget.
  • placement positions the card on the grid of the dashboard.
  • query groups the records of the source sales by the Region dimension and sums the Revenue field for each region.
  • appearance sets three chart colors as six-digit hex values and turns on the animation.
  • interactions enables 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:

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 typeQuery and purpose
column, barOne category dimension and one or more numeric measures; compare groups.
bar-stacked, column-stackedMultiple measure aliases stacked per category; show additive components.
bar-percent, column-percentNormalize positive and negative components separately; values are displayed as shares.
line, area, area-stacked, area-percentOrdered categories, usually grouped dates; show trends and composition over time.
comboColumns on the primary axis and the selected secondaryMeasure as a line with a secondary scale.
waterfallOrdered signed contributions; categories named in chart.totals restart from zero as absolute totals.
bulletA value per category, optional performance bands and a target marker.
heatmapTwo dimensions and a numeric measure; intensity compares intersections.
scatter, bubbleNumeric X/Y aliases; bubbles use a third numeric size alias. Include a dimension to identify observations.
treemapPositive weights per category; rectangle areas compare composition.
small-multiplesA category dimension and a panel dimension selected by panelField; up to 12 panels.
box-plotCategory plus an observation identifier, with one numeric measure; quartiles, median, 1.5-IQR whiskers and outliers.
histogramIndividual numeric observations; use a unique observation dimension to avoid aggregating them away. bins selects 1–100 bins.
mapRegion keys and a numeric measure joined to application-supplied Polygon/MultiPolygon geometry.
pie, donutCategory shares using the existing chart appearance and legend controls.

Chart gallery showing grouped columns, stacked bars and percentage comparisons

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