Skip to main content Skip to complementary content

pivot-table properties

Information noteSTABLE.

This API is reliable and breaking changes are unlikely.

pivot-table()

These are the properties used by Qlik Sense pivot tables.

Version history

Version history
Version state Details
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 | qStringExpression

Visualization title shown if "showTitles": true.

subtitle

Type: String | qStringExpression

Visualization subtitle shown if "showTitles": true.

footnote

Type: String | qStringExpression

Visualization footnote shown if "showTitles": true.

disableNavMenu

Type: Boolean

Disables the hover menu in the visualization.

Default: false

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.

Additional properties:

columnWidths

Type: Array

Array of one value determining the column widths. If omitted, a default value is used.

-1 equals auto.

qDimension

Type: Array

Extends NxDimension, see Engine API: NxDimension.

Additional properties

  • qDef

    Type: Object

    Description: Extends NxInlineDimensionDef, see Engine API: NxInlineDimensionDef.

    qDef 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.
    textAlign Object

    auto: Type: Boolean. Set to auto-align text.

    Default: true

    align: Type: String. Set to manually align text. Can be set as :

    • left
    • right
    • center
    Default: left

    othersLabel StringExpressionContainer String expression container.
  • qAttributeDimensions

    Type: Array

    Description: Extends NxAttrDimDef, see Engine API: NxAttrDimDef.

    id

    Type: 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

Type: Array

Description: Extends NxMeasure, see Engine API: NxMeasure.

Additional properties

  • qDef

    Type: Object

    Description: Extends NxInlineMeasureDef, see Engine API: NxInlineMeasureDef.

    qDef Properties
    Name Type Description
    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.
    textAlign Object

    auto: Type: Boolean. Set to auto-align text.

    Default: true

    align: Type: String. Set to manually align text. Can be set as :

    • left
    • right
    • center
    Default: left

  • qAttributeExpressions

    Type: Array

    Extends NxAttrExprDef, see Engine API: NxAttrExprDef.

    id

    Type: String

    One of:

    • cellBackgroundColor: for attribute expression, expression for background color of table cell.
    • cellForegroundColor: for attribute expression, expression for text color of table cell.

qLayoutExclude

Type: Object

customErrorMessage

Type: Object

Set to define custom error messages.

  • calcCondition

    Type: String

    Description: Deprecated. Use qCalcCondition.qMsg instead. Set to customize the calculation condition unfilled message.

search

Type: Object

Search settings.

Additional properties:

sorting

Type: String

The settings for sorting the values of a dimension.

sorting properties
Name Type Description
auto Boolean

Specifies if the search values of a dimension are auto sorted alphabetically or numerically in ascending order.

Default: true

inherit Boolean

Specifies if the sort settings are inherited from the dimension selected by the user.

sort

All dimension values are sorted by the numeric value of the first measure in a pivot table by setting the property qSortbyYValue in the definition of the hypercube. The sort order affects all dimensions and have precedence before any other sort order defined under the dimensions. It may result in different sort orders for the 2nd and higher dimensions in different branches, depending on their values.

Limitations

  • Only supported if subtotals are calculated.
  • Only supported if all dimensions are vertical (in the row section), and the array of measures is horizontal (all measures are in the column section).
  • Not supported for calculated dimensions.

components

Type: Array

Component settings. All theme component properties are unset (null) when creating a chart. The values for each attribute are fetched from the current theme. Setting any property here will override the theme used.

Additional properties:

key

Type: String

Determines which component the settings apply to.

Default: theme

content

Type: Object

Content font and interaction settings.

content properties
Name Type Description
fontSize Integer

Font size of pivot table content text.

Default: unset

fontColor Object

Set to specify color:

{index: 2, color: '#ff0055'}

Default: unset

hover Object

Set to specify color when hovering over a row.

  • backgroundColor: (String)

    Background color when hovering

    Default: unset

  • color: (String)

    Font color when hovering.

    Default: unset

header

Type: Object

Header object font settings.

header properties
Name Type Description
fontSize Integer

Font size of pivot table header text.

Default: unset

fontColor Object

Set to specify color:

{index: 2, color: '#ff0055'}

Default: unset

scrollbar

Type: Object

Scroll bar settings.

scrollbar properties
Name Type Description
size String

Sets the width of the scroll bar.

Information noteIn touch screen mode, the scroll bar always has a standard size.

Possible values:

  • small
  • medium
  • large

Default: unset

The default is inherited from Theme. If Theme is not set, small becomes the default.

Example using Visualization API

Tip noteFor more examples of how to create pivot tables on the fly, see Mashups: Creating pivot tables.

In this example we create a basic pivot table, containing two dimensions (Year and Quarter) and three measures. The measures have basic number formatting applied and a title is added to the pivot table.

app.visualization.create(
  'pivot-table',
  [
    {
      "qDef": {
        "qFieldDefs": [
          "Date.autoCalendar.Year"
        ],
        "qFieldLabels": [
          "Year"
        ]
      },
      "qNullSuppression": true
    },
    {
      "qDef": {
        "qFieldDefs": [
          "Date.autoCalendar.Quarter"
        ],
        "qFieldLabels": [
          "Quarter"
        ]
      },
      "qNullSuppression": true
    },
    {
      "qDef": {
        "qLabel": "FIR%",
        "qDef": "Avg(FwHit)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        }
      }
    },
    {
      "qDef": {
        "qLabel": "GIR%",
        "qDef": "Avg(GIR)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        }
      }
    },
    {
      "qDef": {
        "qLabel": "Putt avg",
        "qDef": "Avg(Putts)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "#,##0.00",
          "qDec": ".",
          "qThou": ","
        }
      }
    }
  ],
  {
    "showTitles": true,
    "title": "Golf statistics"
  }
).then(function(vis){
  vis.show("QV01");
});

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!