Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creating HyperCubes

Hi,

I would like to create a HyperCube in my mashup, just a simple pie chart for demo purpose. I used this block of code but unfortunately something went wrong.

app.createCube({

qDimensions: [{

qDef: {

qFieldDefs: ["Product Group"]

}

}],

qMeasures: [{

qDef: {

qDef: "SUM([Margin Amount])",

qLabel: ""

}

}],

qInitialDataFetch: [{

qHeight: 20,

qWidth: 8

}]

}), function (reply) {

var valueArray = [];

$.each(reply.qHyperCube.qDataPages[0].qMatrix, function (index, value) {

if (!this[0].qIsEmpty) {

valueArray.push(this[1].qNum);

}

});

$("#pieChart").sparkline(valueArray,  {

type: 'pie',

width: $("#pieChart").width(),

height: $("#pieChart").height()

})

};

In the HTML I've created a div for the pieChart ID:

<div id="pieChart" style= "height: 200px; width: 200px;"></div>

And I am referencing to the sparkline library with this code:

require( ["js/qlik", "http://omnipotent.net/jquery.sparkline/2.1.2/jquery.sparkline.js"]

Any idea what could be the issue with this code?


Thank you,

Zoli

dberkesacn

1 Solution

Accepted Solutions
m_s
Partner - Creator II
Partner - Creator II

Hello Zoltan,

you have a typo (i marked it for you). Basically you wrote

     app.createCube(cube) , function(reply){};

but it should be

     app.createCube(cube, function(reply){ });

Zoltan Farkas schrieb:

Hi,

I would like to create a HyperCube in my mashup, just a simple pie chart for demo purpose. I used this block of code but unfortunately something went wrong.

app.createCube({

qDimensions: [{

qDef: {

qFieldDefs: ["Product Group"]

}

}],

qMeasures: [{

qDef: {

qDef: "SUM([Margin Amount])",

qLabel: ""

}

}],

qInitialDataFetch: [{

qHeight: 20,

qWidth: 8

}]

}), function (reply) {

var valueArray = [];

$.each(reply.qHyperCube.qDataPages[0].qMatrix, function (index, value) {

if (!this[0].qIsEmpty) {

valueArray.push(this[1].qNum);

}

});

$("#pieChart").sparkline(valueArray,  {

type: 'pie',

width: $("#pieChart").width(),

height: $("#pieChart").height()

})

};

In the HTML I've created a div for the pieChart ID:

<div id="pieChart" style= "height: 200px; width: 200px;"></div>

And I am referencing to the sparkline library with this code:

require( ["js/qlik", "http://omnipotent.net/jquery.sparkline/2.1.2/jquery.sparkline.js"]

Any idea what could be the issue with this code?


Thank you,

Zoli

dberkesacn

Mathias

View solution in original post

2 Replies
m_s
Partner - Creator II
Partner - Creator II

Hello Zoltan,

you have a typo (i marked it for you). Basically you wrote

     app.createCube(cube) , function(reply){};

but it should be

     app.createCube(cube, function(reply){ });

Zoltan Farkas schrieb:

Hi,

I would like to create a HyperCube in my mashup, just a simple pie chart for demo purpose. I used this block of code but unfortunately something went wrong.

app.createCube({

qDimensions: [{

qDef: {

qFieldDefs: ["Product Group"]

}

}],

qMeasures: [{

qDef: {

qDef: "SUM([Margin Amount])",

qLabel: ""

}

}],

qInitialDataFetch: [{

qHeight: 20,

qWidth: 8

}]

}), function (reply) {

var valueArray = [];

$.each(reply.qHyperCube.qDataPages[0].qMatrix, function (index, value) {

if (!this[0].qIsEmpty) {

valueArray.push(this[1].qNum);

}

});

$("#pieChart").sparkline(valueArray,  {

type: 'pie',

width: $("#pieChart").width(),

height: $("#pieChart").height()

})

};

In the HTML I've created a div for the pieChart ID:

<div id="pieChart" style= "height: 200px; width: 200px;"></div>

And I am referencing to the sparkline library with this code:

require( ["js/qlik", "http://omnipotent.net/jquery.sparkline/2.1.2/jquery.sparkline.js"]

Any idea what could be the issue with this code?


Thank you,

Zoli

dberkesacn

Mathias

Anonymous
Not applicable
Author

Wow, I should have run through my code one more time!

Thank you, Mathias.

Zoli