Using Extension editor in Qlik Dev Hub

In the previous chapter, we discussed a recipe to develop a visualization extension in Qlik Sense by writing the code manually in the .js and .qext files. One of the easier methods to develop extension visualization in Qlik Sense is using Extension editor in Qlik Dev Hub.

A Qlik Dev Hub is an integrated development toolbox used for building visualizations and mashup websites. It does not come with a separate installation package, but the editor and the API libraries are provided with Qlik Sense Desktop.

The previous recipe has explained all the basics of the Dev Hub. This recipe will introduce the user to the process of building a basic chart extension using Extension editor in Qlik Dev Hub. The extension workbench supports the .js, .qext, .css, and .html formats.

Getting ready

For the purpose of this recipe,we will make use of an inline data load which gives the sales information for four countries:

  1. Create a new Qlik Sense application and call it QS_DevHub_Extensions.
  2. Load the following script in the application:
    Sales:
    LOAD * INLINE [
    Country, Sales
    USA, 1000
    UK, 2000
    France, 3000
    Germany, 4000
    ];
  3. Save the application at this point and move on to build the visualization using Extension editor.
  4. Before starting Extension editor, make sure you have Qlik Sense Desktop running in the background.

How to do it…

  1. Open Qlik Dev Hub using the following URL:
    http://localhost:4848/dev-hub
  2. Click on the How to do it… button available in the left-hand side pane of Qlik Dev Hub.
  3. A new Extension editor window opens. Click on the menu dropdown How to do it… on the toolbar.
  4. Now, click on How to do it… to create a new project.
  5. Name the new visualization as QlikDevHub_Extension.
  6. Under Template, select Chart template and click on How to do it…:
    How to do it…
  7. This opens up the tabs for the JavaScript, .qext, and other related files for the extension. If we want to get added functionalities in the extension, we can modify the JavaScript code here as per requirements.
  8. As seen, the editor has automatically created the mandatory files and the script required for the extension.
  9. Edit the script on the QlikDevHub_Extension.qext tab as follows:
    "description": "Qlik Sense extension using the Qlik Dev Hub",
    "author": "<User Name>"
  10. The result of the preceding code will look like this:
    How to do it…
  11. The QlikDevHub_Extension.js tab contains the JavaScript required for rendering the visualization. One can edit this tab if required to do so.
  12. Save and close the window.
  13. Open the QS_DevHub_Extensions application we created in step 1 of the Getting ready section in Qlik Sense Desktop.
  14. Create a new sheet and enter the Edit mode by clicking on How to do it….
  15. The QlikDevHub_Extension extension object is now available in the Assets panel on the left. Drag the extension onto the sheet.
  16. Add Country as a dimension.
  17. Add the following measure:
    Sum (Sales) 
  18. Name the chart as Sales by Country.
  19. The resultant chart would be as follows:
    How to do it…

How it works…

The Qlik Sense Extension editor provides JavaScript APIs, which consist of a number of methods and properties to build the custom visualizations. The editor autogenerates the mandatory files required for the extension to work.

There's more…

If we want to define custom styles for our visualization, we can do so by using one or more CSS files. The content for the CSS files first need to be loaded to the document's header or alternatively added as a link to a style sheet to the document's header. Styles can also be defined using the RequireJS CSS plugin.

Additional files such as .css, .js, and .html can be added using the There's more… button located at the top-right hand corner of the Extension editor workspace:

There's more…

See also

  • Using Qlik Dev Hub to generate mashups
..................Content has been hidden....................

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