Visualization API

Namespace: qlik.app.visualization

The Visualization API allows you to create Qlik Sense visualization on the fly, based on a session object. It's important to note session objects are not persisted in the app and will be destroyed once the session times out. Furthermore, on top of creating new visualizations, you can also fetch existing visualizations from an app using the API.

This is a new way of embedding new and modifying existing visualizations. Until now, you had two levels to work on to integrate visualizations into your web page or mashup:

  • Taking a visualization that has been created in the app and injecting it to your web app, using the getObject method
  • Programmatically creating a generic non-Qlik visualization (using a third party, for example) after you've received the data from the Qlik Engine API.

With the first one, each time you want to make a change in the visualization, you will need to go back to the Qlik Sense app and modify the object, and the charts will need to be available in the Qlik Sense app. The second one might be compelling but equally difficult to implement.

The Visualization API introduces a third method, which dynamically creates Qlik Sense visualizations on the fly, by passing a set of parameters and returning the visualization.

For example, you can use the following to create a bar chart with a custom title:

app.visualization.create(     
'barchart',
["Case Owner Group","=Avg([Case Duration Time])"],
{"title":"On the fly barchart"} )
.then(function(vis){
vis
.show("QV03");
}
);

The Visualization API only defines two methods:

  • app.visualization.get(visid): This is identical to the getObject method, but you need to show the visualization yourself, with the new show method.
  • app.visualization.create(type, cols, options): This call allows you to dynamically define a chart in your JavaScript code, reuse the existing visualizations (built-in or extensions), supply the dimensions and measures, and set other options for the chart.
The Visualization API is one of the most relevant APIs in the Capability API. The fact that you can easily modify and recreate charts by programmatically defining its settings allows you to potentially build a new visualization client. 
..................Content has been hidden....................

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