Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Mathias
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
Mathias
Wow, I should have run through my code one more time!
Thank you, Mathias.
Zoli