Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I followed the code mentioned in the following link of the community:
Anyone know how to use Google Charts (not Maps) in an extension?
I downloaded the file which was uploaded by MikeCarpenter as I wanted to make an extension using the Google Pie Chart. However I am unable to take the input from Qlik when I use this code. On the contrary whenever I enter some data within the JavaScript itself the chart gets rendered. Can anyone please help me with this issue as I am unable to understand where I am going wrong. I am attaching the code here and I have commented out the lines where I have manually entered the data.
Please find the code below:
Qva.LoadScript("http://www.google.com/jsapi?callback=loadGoogleCoreChart", function () {
});
function loadGoogleCoreChart() {
google.load('visualization', '1', {
packages: ['corechart'],
callback: googleCoreChartLoaded
});
}
function googleCoreChartLoaded() {
Qva.AddExtension('QlikView/Examples/GooglePieChart', function () {
//Declaring a two dimensional array (an array of arrays)
var row = new Array(this.Data.Rows.length + 1);
for (var i = 0; i <= this.Data.Rows.length; i++) {
row = new Array(2);
}
//Getting the data from QlikView
for (var j = 1; j <= this.Data.Rows.length; j++) {
row
var temp = this.Data.Rows[j - 1][1].text;
row
}
var data = google.visualization.arrayToDataTable(row);
alert("hello");
/*var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
*/
new google.visualization.PieChart(this.Element).draw(data, { chartArea: { left: 20, top: 20, width: "100%", height: "100%"} });
});
}
Please help me out, it is urgent.