Published
Edited
May 5, 2021
1 star
Insert cell
Insert cell
Insert cell
{
const app = await enigmaApp;
const properties = {
qInfo: { qType: 'visualization' },
qHyperCubeDef: {
qDimensions: [
{ qDef: { qFieldDefs: ['Case Owner Group'] }, qNullSuppression: true },
{ qDef: { qFieldDefs: ['Priority'] }, qNullSuppression: true },
],
qMeasures: [
{ qDef: { qDef: 'Avg([Case Duration Time])', autoSort: false }, qSortBy: { qSortByNumeric: -1 }},
],
qInitialDataFetch: [{
qTop: 0,
qLeft: 0,
qWidth: 3,
qHeight: 5,
}],
qSortByAscii: 1,
qSortByLoadOrder: 1,
qInterColumnSortOrder: [1, 0],
qSuppressZero: true,
qSuppressMissing: true,
}
}
const model = await app.createSessionObject(properties);
let layout = await model.getLayout();
let data = layout.qHyperCube.qDataPages[0].qMatrix
const columns = layout.qHyperCube.qSize.qcx;
const totalheight = layout.qHyperCube.qSize.qcy;
const pageheight = 5 // Math.floor(10000 / columns);
const numberOfPages = Math.ceil(totalheight / pageheight);
for (let i = 1; i < numberOfPages; i++) {
const page = {
qTop: pageheight * i,
qLeft: 0,
qWidth: columns,
qHeight: pageheight,
};
const row = await model.getHyperCubeData('/qHyperCubeDef', [page]);
data.push(...row[0].qMatrix);
}
const table = data.map(x => `<tr><td>${x[0].qText}</td><td>${x[1].qText}</td><td>${x[2].qText}</td></tr>`);
return html`
<table style="width:100%">
<tr>
<th>Department</th>
<th>Priority</th>
<th>Avg Duration</th>
</tr>
${table}
</table>
`
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more