Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
nferna001
Partner - Contributor II
Partner - Contributor II

Create method

Hello

I am exploring the creation of custom visualisations, using the capability API.

I am facing a problem when creating a dynamic pivot table.

define(["qlik"

],

        function (qlik) {

            return {

                support: {

                    snapshot: true,

                    export: true,

                    exportData: false

                },

                paint: function ($element) {

                    $element.html("<div qv-extension id='myTable'></div>");

                    var app = qlik.currApp();

                    var options = {

                        qHyperCubeDef: {

                            qSuppressZero: true,

                            qMode: "P",

                            qShowTotalsAbove: true,

                            qIndentMode: true,

                            qAlwaysFullyExpanded: false,

                            qNoOfLeftDims: 2,

                            qInitialDataFetch: [{

                                    qWidth: 2,

                                    qHeight: 1000

                                }]

                        },

                        title: 'My code generated pivot-table'

                    };

                    var selectedFields = [

                        {qLibraryId: "jpgm", qType: "dimension"},

                        {qLibraryId: "RXHnxGJ", qType: "dimension"},

                        {qLibraryId: "XzkbUQj", qType: "measure"},

                        {qLibraryId: "PVkSbPD", qType: "measure"}

                    ];

                    app.visualization.create('pivot-table', selectedFields, options).then(function (visual) {

                        window.visual = visual;

                        visual.show('myTable');

                    });

                    //needed for export

                    return qlik.Promise.resolve();

                }

            };

        });

This renders a chart that has a container with no height and therefore, the chart does not show up unless if i force a height to it. And still, it only shows one row.

Why does this happen?

Thank you for the help!

3 Replies
ErikWetterberg

Hi,

As far as I know you need to set a height.

Erik Wetterberg

nferna001
Partner - Contributor II
Partner - Contributor II
Author

A hard-coded height? as in css? or in the properties?

ErikWetterberg

Since Qlik Sense visualizations will fill the element you give them, you need to set the size with css.

Erik Wetterberg