Skip to main content Skip to complementary content

Getting started building visualization extensions

Tip noteThe easiest way to get started building your visualization extension is to use Qlik Sense Desktop. This section assumes that Qlik Sense Desktop is being used.

Creating the container

Create a folder that will contain your assets. The folder should be created in the following location: C:\Users\[UserName]\Documents\Qlik\Sense\Extensions\.



Creating the QEXT file

The next step is to create a QEXT file in the folder we just created and name it exttut-01-helloworld.qext.

It should contain the following information:

	"name" : "Simple Hello World 01",
	"description" : "Extension Tutorial, Simple Hello World.",
	"icon" : "extension",
	"type" : "visualization",
	"version": "0.1",
	"author": "Qlik"

Creating the main script file

Then it is time to create the main script file. This is also placed in the same folder as the QEXT file and we name it exttut-01-helloworld.js. Paste the following code into the script file and then save it:

define( [
    function ( $ ) {
        'use strict';

        return {

            //Paint resp.Rendering logic
            paint: function ( $element, layout ) {

                var $helloWorld = $( document.createElement( 'div' ) );
                $helloWorld.html( 'Hello World from the extension "SimpleHelloWorld"<br/>' );
                $element.append( $helloWorld );

    } );

Testing the visualization extension

Now is a good time to test your visualization extension.

  1. Open Qlik Sense Desktop.
  2. Open an existing app or create a new one.
  3. Open an existing sheet or create a new one.
  4. Go to Edit mode. The visualization extension should be visible in the library.

    Extensions list under custom objects

  5. Drag and drop the visualization extension onto the sheet and exit Edit mode.

You should see something like the following:

Example extension in a sheet

Fine tuning the visualization extension

If you resize the visualization extension or the browser window you will realize that some thing is wrong since the output gets multiplied.

Resized example extension with text repeating multiple times

This happens because the paint method is called every time the visualization extension is rendered and therefore resizing the visualization extension triggers the paint method. This means that a new $helloWorld object is appended to $element on every resize.

            //Paint resp.Rendering logic
            paint: function ( $element, layout ) {

                var $helloWorld = $( document.createElement( 'div' ) );
                $helloWorld.html( 'Hello World from the extension "SimpleHelloWorld"<br/>' );
                $element.append( $helloWorld );


There are several ways of solving this and we will introduce two of these below.

Remove existing content

You can remove all child nodes of $element at the beginning of the paint method, using the jQuery empty() method. Add the following line at the beginning of paint.


Detect if your new node already exists

Use the layout object to get the unique id of the current object to prevent conflicts if you are using the same object several times on a sheet. You can detect if your new node already exists by adding the following code:

var id = layout.qInfo.qId + '_helloworld';
var $helloWorld = $( '#' + id );
if ( !$helloWorld.length ) {
    console.log( 'No element found with the given Id, so create the element' );
    $helloWorld = $( document.createElement( 'div' ) );
    $helloWorld.attr( 'id', id );
    $helloWorld.html( 'Hello World' );
    $element.append( $helloWorld );
} else {
    console.log( 'Found an element with the given Id, so just change it' );
    $helloWorld.html( 'Hello World' );

Source code

Download the Simple Hello World extension

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!