Skip to content
Stand with Ukraine flag

Trend value card

  • Widget
  • 13 installs
  • v1.0.0
  • Jul 29, 2026
  • MIT license
  • v4.2+
Trend value card

One time-series key as a large number for the selected time window, compared with the same period earlier. Shows percent or absolute change, coloured by whether rising or falling is good for that metric — a falling value can read green. Compare against the previous window, or an hour, a day or a week earlier. Latest, average, sum, min or max. Icon, colours and fonts configurable; text auto-scales to fill the card.

Widget Type
  • Timeseries
Category
  • Cards & Info

Trend value card

Shows one time-series key from one entity as a large number for the selected time window, and compares it with the same period earlier so the direction of travel is always in view. The text sizes itself to fill whatever space the card is given.

Features

  • One number per card, computed over the dashboard time window
  • Automatic comparison with an earlier period, as percent change, absolute change, or both
  • Comparison period selectable: the previous window of equal length, or an hour, a day or a week earlier
  • Direction-aware colouring — a falling value reads green when falling is the good outcome
  • Value can be the latest reading, average, sum, minimum, maximum, first, or the change across the window
  • Last update time, relative or absolute, with the exact timestamp on hover
  • Icon on any side, with its own colour and background
  • Auto-scaling text that fills the card, plus four vertical layouts
  • Fonts and colours configurable per element, with no scripting
  • No external libraries

Data keys

Exactly one time-series key from one entity. The widget enforces this — the configuration UI will not offer a second datasource or a second key.

KeyTypeNotes
any numeric keytimeseriesThe value to display. Non-numeric and empty readings are skipped

Nothing is hardcoded about the key name: point it at temperature, energyProduced, waterConsumption, or anything else numeric.

Label, units and decimals come from the data key, set where you configure the key itself. The widget deliberately does not duplicate them in its own settings — two places to set the same thing means one of them is silently ignored. A key with no label falls back to its name, and a key with no decimals to two.

The card reads [timestamp, value] pairs, so server-side aggregation works too: if the time window aggregates to one-minute averages, the card computes from those averages.

How the trend is calculated

The big number covers the widget time window. The trend applies the same calculation to an earlier window of identical length:

Compare againstEarlier window
Previous period (dynamic)immediately before the current one — a 24 h window against the 24 h before it
1 hour earlierthe current window shifted back one hour
1 day earliershifted back one day
1 week earliershifted back one week
No comparisontrend row hidden

Both sides are reduced by the same function — whichever is set in Value shown — so an average is compared with an average and a sum with a sum. Percent change is (current − previous) / |previous| × 100, and the note under it names the baseline, for example vs previous 24 h.

Two cases are reported rather than faked. When the earlier window holds no data the trend reads no comparison; when the earlier value is exactly zero, percent change is undefined, so the card falls back to the absolute change.

The earlier period is fetched with a second, private query. The widget never moves the dashboard time window.

Trend colours

StateDefaultMeaning
Good change#2e7d32 greenMoving in the direction set by Which direction is good
Bad change#d12730 redMoving against it
No change#5f6368 greyEqual values, or no comparison available

The arrow always points the way the value actually moved; only the colour reflects whether that is welcome. Set Which direction is good to Falling is good for error rates, downtime, water or energy consumption, or to Neither to colour every change the same.

That separation is the point of the widget: a water meter reading 38.4 m³ with a green downward arrow says less water than yesterday, and that is good in one glance.

Configuration

Value

SettingDefaultDescription
Value shownLatest readingLatest, average, sum, minimum, maximum, first, or the change across the window
Group thousandson12,345.7 instead of 12345.7, using the dashboard locale
Show labelonHides the label line without touching the data key
Text when there is no dataShown when the window holds no numeric readings

Trend

SettingDefaultDescription
Compare againstPrevious periodSee the table above
Show trendon
Trend showsPercent changePercent, absolute, or both
Which direction is goodRising is goodControls the colour, not the arrow
Show what it is compared toonAppends vs previous 24 h and similar
Good / Bad / No change coloursgreen / red / grey

Icon

SettingDefaultDescription
IconnoneAny Material or MDI icon; leave empty to hide the icon block
Icon colour#ffffff
Icon backgroundtheme primaryEmpty follows the platform’s primary colour
Icon sideLeft of the valueLeft, right, above, or below
Icon alignment on the other axisCenterStart, center, or end

Icon side picks which side of the value the icon sits on; Icon alignment positions it along the other axis, so start means top when the icon is beside the value and left when it is stacked. Twelve combinations. When the icon is stacked and aligned to center or end, the label, value, trend and timestamp follow the same alignment so the card reads as one block.

Last update

SettingDefaultDescription
Show last update timeonTimestamp of the newest reading in the window
FormatRelative4 minutes ago, or an absolute date and time
PrefixUpdated Set empty for just the time
Text and colourgreyFont and colour

Style

SettingDefaultDescription
Auto-scale text to the widget sizeonValue, label, trend and icon are sized from the card’s dimensions
Vertical content layoutGrouped in the middleMiddle, top, bottom, or spread across the full height
Value / Label / Trend / Last update textinheritedWeight, style and family per element
Value / Units / Label coloursdark / grey / grey

Sizing and layout

Auto-scale derives every size from the room the card actually has, and from how many rows are switched on — hiding the label, trend or timestamp gives the number the space they were using. On a 390 × 190 card with everything shown the value lands around 63 px; with the label alone above it, around 95 px. The icon is accounted for too: beside the value it takes width, above or below it takes height. Whatever the estimate, the value then shrinks until it fits, so a long number never overflows.

Vertical content layout decides how the content block is distributed inside the full height:

LayoutResult
Grouped in the middleLabel, value, trend and timestamp together, vertically centred
Grouped at the topThe same block pinned to the top
Grouped at the bottomThe same block pinned to the bottom
SpreadLabel at the top, value and trend in the middle, timestamp at the bottom

Spread is the one for cards taller than their content needs — it uses the whole height deliberately instead of leaving a gap, which is what makes a row of these cards look intentional. The value and trend stay glued together in every mode, so the change never drifts away from the number it belongs to.

With auto-scale on, the size in the font settings is ignored; weight, style and family still apply. Turn it off to control sizes yourself.

The widget declares no font family of its own. It inherits whichever face the ThingsBoard instance uses, so it stays consistent with the surrounding dashboard and does not override white-labeling.

Actions

One action source, Card click, appears in the widget’s Actions tab. Attach any action type — navigate to a dashboard state, open a dialog, run custom JavaScript — to turn the card into a drill-down to the full history of the key it shows.

Requirements

Community and Professional editions both work; nothing here uses PE-only features, and no external libraries are loaded.

One behaviour to know before building a dashboard around it: with a realtime time window the current period moves continuously, so the earlier period is re-queried only after the window has drifted by 10% of its own length. A 24 h realtime window therefore refreshes its comparison about every 2.4 hours rather than every second. The number itself and the last update time still follow every incoming reading.

Share Your Widget with the Community

Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.