Qlik Community

Integration, Extension & APIs

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

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
nferna001
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

Hi,

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

Erik Wetterberg

nferna001
Partner
Partner
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