kpi properties

Note: STABLE.
This API is reliable and breaking changes are unlikely.

kpi()

These are the properties used by Qlik Sense kpi objects.

Version history

Introduced 2.2

Properties

showTitles

Type: Boolean

Show title for the visualization.

Default: true.

showDetails

Type: Boolean

Sets if visualization details should be shown.

Default: false

title

Type: String | Expression

Visualization title shown if "showTitles": true.

subtitle

Type: String | Expression

Visualization subtitle shown if "showTitles": true.

footnote

Type: String | Expression

Visualization footnote shown if "showTitles": true.

qHyperCubeDef

Type: Object

The hypercube definition used by most visualizations.

A subset of the properties available in the qHyperCubeDef is presented here. For complete documentation of all available properties, see Engine API: HyperCubeDef.

Properties

Name Type Description
qDimensions Array

Extends NxDimension, see Engine API: NxDimension.

Additional properties

Name Type Description
qDef Object

Extends NxInlineDimensionDef, see Engine API: NxInlineDimensionDef.

Additional properties

Name Type Description
autoSort Boolean

Set to automatically sort the dimension.

Default: true

cID String ID used by the client. Must be unique within the current chart.
othersLabel StringExpressionContainer
qAttributeDimensions Array

Extends NxAttrDimDef, see Engine API: NxAttrDimDef.

Additional properties

Name Type Description
id String

One of:

  • colorByAlternative: colors the chart using different dimensions. Can be used together with color.mode="byDimension" for attribute dimensions.
  • colorByExpression: used together with color.mode="byExpression".
qMeasures Array

Extends NxMeasure, see Engine API: NxMeasure.

Additional properties

Name Type Description
qDef Object

Extends NxInlineMeasureDef, see Engine API: NxInlineMeasureDef.

Additional properties

Name Type Description
conditionalColoring Object

Coloring settings.

Properties

Name Type Description
useConditionalColoring Boolean

Set if the object should use conditions to color the object.

Default: false

singleColor Integer

Deprecated. Use paletteSingleColor instead.

Set to reference to a color in the color palette.

Default: 3

paletteSingleColor Integer

Color information structure. Holds actual color and index in palette.

Name Type Description
index Integer

Index in palette.

Default: 6

color String Color as HEX string.
segments Object

Properties

Name Type Description
limits Array

Properties

Name Type Description
value Number

Value for limit between two segments.

Default: 1

gradient Boolean

Set if the limit should be considered as a hard limit (false) or a gradient limit (true)

Default: false

colors Array

Colors of the segments. Array should contain (segment limits) + 1 colors.

Properties

Name Type Description
color Integer

Integer reference to a color for the segment.

Defualt: 2

icon String Set the actual string for the glyph (using an icon font).
paletteColors Array

Colors of the segments. Array should contain (segment limits) + 1 colors.

Properties

Name Type Description
color Integer

Color as a string.

index Integer

Integer reference to a color for the segment.

Default: 6

icon String Set the actual string for the glyph (using an icon font).
measureAxis Object

Set the limits for the range

Properties

Name Type Description
min ValueExpressionContainer
max ValueExpressionContainer
autoSort Boolean

Set to automatically sort the measure.

Default: true

cID String ID used by the client. Must be unique within the current chart.
numFormatFromTemplate Boolean

When enabled, the number format to use can be selected from multiple predefined formats based on the desired type: number or date.

Default: true

isCustomFormatted Boolean Set to true to toggle off the default client formatting.
qLayoutExclude Object

 

customErrorMessage Object

Set to define custom error messages.

Name Type Description
calcCond String

Deprecated. Use qCalcCondition.qMsg instead.

Set to customize the calculation condition unfilled message.

showMeasureTitle

Type: Boolean

Sets if the main title of the first measure should be displayed.

Default: true

textAlign

Type: String

Aligns the text in the KPI object. Can be one of:

  • left
  • center
  • right

Default: center

fontSize

Type: String

Sets the font size of the main value. Can be one of:

  • S (small)
  • M (medium)
  • L (large)

Default: M

useLink

Type: Boolean

Set if the KPI will link to another sheet when clicked.

Default: false

sheetLink

Type: String

The sheet id (as a string) of the sheet to link to if "useLink": true.

openUrlInNewTab

Type: Boolean

Sets if the KPI opens in another tab when clicked. If false, it will only redirect from the current page.

Default: true

color

Type: Object

Controls if colors encoded in master items should be used.

Name Type Description
useBaseColors String

Use colors encoded in master items. One of:

  • off
  • measure

Default: measure

Example using Visualization API

Tip: For more examples of how to create KPIs on the fly, see Mashups: Creating KPIs.

In this example we create a basic KPI, containing a single measure. Measure titles are displayed in the visualization by default.

app.visualization.create(
  'kpi',
  [
    {
      "qDef": {
        "qLabel": "GIR %",
        "qDef": "Avg(GIR)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        }
      }
    }
  ],
  {
    "showTitles": false,
    "showMeasureTitle": true,
    "textAlign": "center",
    "fontSize": "L"
  }
).then(function(vis){
  vis.show("QV01");
});

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?