Skip to main content

KPI

The KPI (Key Performance Indicator) widget is a simple widget that displays values arranged in a grid. KPIs can have a title, value, and a VS section (the subtitle of the KPI).

Widget KPI

Basic usage

We will create a KPI widget with two values. First, paste this code into a Python block and execute it:

price = 100
total_sales = 120000

Then, create a KPI Widget and go to its 'Elements' tab. Create two elements:

  • Set the titles to Price and Total Sales respectively.
  • Set the values to $price and $total_sales respectively.

Save the widget, and both values should be displayed.

API reference

Basic

Setting nameTypeDescriptionDefault
Horizontal gutter8 | 16 | 24 | 32 | 40 | 48The horizontal gutter between the KPIs.24
Vertical gutter8 | 16 | 24 | 32 | 40 | 48The vertical gutter between the KPIs.24
Numeral format for integersstring/numeraljsThe numeral format for integers. See Numeral.js0,0
Numeral format for floatsstring/numeraljsThe numeral format for floats. See Numeral.js0,0.00

Style

KPI Title

Setting nameTypeDescriptionDefault
Title font sizenumberThe font size of the title.14
Title font familystringThe font family of the title.

KPI Value

Setting nameTypeDescriptionDefault
Value font sizenumberThe font size of the value.24
Value font familystringThe font family of the value.

Elements

Re-ordering elements

You can re-order the KPI elements by dragging and dropping them in the 'elements' tab.

Basic

Setting nameTypeDescriptionDefault
ElementstringTitle of the KPI element. Will only be use to manage settings.idx:<element_index>
Data typeauto | numeric | stringThe data type of the KPI value.auto
TitlestringThe title of the KPI element.
ValuestringThe value of the KPI element.
IconstringThe icon of the KPI element.

Style

Setting nameTypeDescriptionDefault
Icon and Value colorstring/colorThe color of the icon and value.#000000
Title font sizenumberThe font size of the title.14
Title font familystringThe font family of the title.
Value font sizenumberThe font size of the value.24
Value font familystringThe font family of the value.

Format

Setting nameTypeDescriptionDefault
SuffixstringThe suffix of the KPI value.
SpannumberNumber of grid cells the KPI spans, out of 24 per row.6
OffsetnumberNumber of grid cells to offset the KPI from the left, out of 24 per row.0

VS

Setting nameTypeDescriptionDefault
TextstringThe text of the VS section.
IconstringThe icon of the VS section.
Colorstring/colorThe color of the VS section.#ff4d4f

Events

The Events settings let you trigger actions in response to clicks on the widget elements. When the event is activated, the current block and the subsequent blocks are executed.

Setting nameTypeDescriptionDefault
On eventnone | onClickWhether to activate the event onClick or notnone
Event variablestringName of the variable to store the data when the event is triggered

See also

  • All widgets — browse the full widget catalog.
  • Chart — visualize the trends behind your KPIs.