Columns (dimensions and measures)
When using the Visualization API or the qlik-visual web-component, hypercubes are defined in the cols parameter. The number of columns needed to be specified vary depending on the visualization type. If too few columns are specified you will receive an incomplete visualization error just as if the visualization was created in the Qlik Sense client.
There are three different ways of specifying the columns:
- As a string.
- As a NxDimension or NxMeasure structure:
- As a reference to a predefined dimension or measure, a so-called master item.
The above three methods can be combined in the same create statement. You can use a simple string syntax for one column, a more advanced object for another and a predefined master measure for the third.
If a string starts with =, it will be treated as a measure, otherwise it is treated as a dimension.
Use the object syntax if you want to set more options for your columns. If you. for example, create a pivot table with labels, you should use qFieldLabels for dimensions and qLabel for measures.
You can limit the data set to only show the top five values using qOtherTotalSpec.
Referencing predefined dimensions and measures
You can use dimensions and measures that are predefined in the app. This is mostly relevant if the user should be able to select dimensions and measures from lists. You must know the Dimension ID or the Measure ID, which is defined in the qLibraryID property. You must also state if it is a measure or a dimension in the qType property.