Expressions

Try to leverage the powerful associative Qlik Engine as much as you can by implementing your settings as expressions as much as possible. This will allow your users to use Qlik expressions, variables, and even dynamically define your chart properties using conditions. Variables, in particular, are a compelling reason to have each setting available set as an expression because you can then control settings of multiple charts of the same kind across an app or a collection of apps via variables—this reduces technical debt. 

The challenge here lies in the fact that sliders, button groups, and other native custom components that improve the user experience do not support expressions. As such, one way to overcome the limitation is to use two components for each property, one for a user-friendly handling and another one sitting below, which is used to help define the property as an expression, for example:

fontSizeSlider: { 
type
: "number",
component
: "slider",
label
: "Font Size (px)",
ref
: "FontSizeSliderValue",
min
: 10,
max
: 20,
step
: 1,
defaultValue
: 15
change: function(prop){
//Sets the fontSize variable based on the slider value.
prop.fontSize = prop.
FontSizeSliderValue
}

},
fontSize: {
type: "integer",
expression: "optional",
ref: "fontSize",
defaultValue: 15
}

In the preceding example, you would then reference fontSize in the code.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.181