Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Partner
Partner

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
Honored Contributor

Re: Create method

Hi,

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

Erik Wetterberg

Partner
Partner

Re: Create method

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

ErikWetterberg
Honored Contributor

Re: Create method

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

Erik Wetterberg