Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

ajaykakkar93
Contributor

Qlik Sense Retrieve chart dimensions and measure information using Javascript

Qlik Sense Retrieve chart dimensions and measure information using Javascript

Hi everyone,

I am trying to retrieve the information of any type visualization using javascript

  • Chart measure - SUM(something), AVG(something), COUNT(something) etc.
  • Chart dimension - Field used to apply the measure
  • Chart - color properties (which color mode is used)
  • Sorting - Asc or Desc.

I'll appreciate some help on this.

Thanks:

Ajay Kakkar

Regards & Thanks,
Ajay Kakkar
ajaykakkar93@gmail.com
1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: Qlik Sense Retrieve chart dimensions and measure information using Javascript

‌Try getProperties https://help.qlik.com/en-US/sense-developer/April2018/apis/EngineAPI/services-GenericObject-GetPrope...

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
4 Replies
erik_wetterberg
Honored Contributor

Re: Qlik Sense Retrieve chart dimensions and measure information using Javascript

‌Try getProperties https://help.qlik.com/en-US/sense-developer/April2018/apis/EngineAPI/services-GenericObject-GetPrope...

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
ajaykakkar93
Contributor

Re: Qlik Sense Retrieve chart dimensions and measure information using Javascript

Hi erik.wetterberg ,

    i would love if you can give an example.?

Regards & Thanks,
Ajay Kakkar
ajaykakkar93@gmail.com
erik_wetterberg
Honored Contributor

Re: Qlik Sense Retrieve chart dimensions and measure information using Javascript

‌The getProperties Will get you the charts properties, which includes inline mensurens and dimensions. IF the chart utses library dimensions and measures, you will need to make additional calls for those. I have written about that here:

https://extendingqlik.upper88.com/qlik-sense-generic-object-iv-the-lists/

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
ajaykakkar93
Contributor

Re: Qlik Sense Retrieve chart dimensions and measure information using Javascript

Hi,

i managed to make this code(this codes works fine), but when i loop through it lot of objects are skipped in between...

var dim, mes, mstedim, mstrmes;

if (model.properties.qHyperCubeDef) {

// dim start

console.log('dim_' + objid, model.properties.qHyperCubeDef);

if (model.properties.qHyperCubeDef.qDimensions["0"]) {

$.each(model.properties.qHyperCubeDef.qDimensions, function(key, val) {

//console.log('dim_'+objid,val);

if (!val.qLibraryId == '' || !val.qLibraryId == "") {

//console.log('libdim_'+objid,getMasterDimById(app,val.qLibraryId));

dim = '<td>' + val.qLibraryId + '</td>';

} else if (!(val.qDef.qFieldDefs).length == 0) {

$.each(val.qDef.qFieldDefs, function(key1, val1) {

//console.log('dim_'+objid,val1);

dim = '<td>' + val1 + '</td>';

});

} else {

dim = '<td>No Dim</td>';

console.log('no dim');

}

});

} else {

dim = '<td>No Dim</td>';

}

// dim end

// mes start

//console.log(model.properties.qHyperCubeDef.qMeasures);

if (model.properties.qHyperCubeDef.qMeasures["0"]) {

$.each(model.properties.qHyperCubeDef.qMeasures, function(key, val) {

//console.log('mes_'+objid,val);

if (!val.qLibraryId == '' || !val.qLibraryId == "") {

//console.log('libmes_'+objid,val.qLibraryId,getMasterMesById(app,val.qLibraryId));

mes = '<td>' + val.qLibraryId + '</td>';

} else if (val.qDef.qDef) {

//console.log('mes_'+objid,val.qDef.qDef);

mes = '<td>' + val.qDef.qDef + '</td>';

} else {

mes = '<td>No Mes</td>';

console.log('no mes');

}

});

} else {

dim = '<td>No Mes</td>';

}

// mes end

var out = tabledata + '' + dim + '' + mes;

$('#drillObj').append(out + '</tr>');

}

Regards & Thanks,
Ajay Kakkar
ajaykakkar93@gmail.com
Community Browser