Skip to content

Instantly share code, notes, and snippets.

define(['d3'], function (d3) {
const ANIMATION_DURATION = 300;
var viz = {
x: d3.scale.ordinal(),
y: d3.scale.linear(),
xAxis: function () { return d3.svg.axis().scale(viz.x).orient('bottom') },
yAxis: function () { return d3.svg.axis().scale(viz.y).orient('left') }
};
@mindspank
mindspank / d3bar.js
Created June 2, 2016 06:15
qsocks d3 barchart
qsocks.Connect(config)
.then(global => global.getActiveDoc()) // Or open a doc, in this scenario we already had a scoped app.
.then(doc => {
// bar chart
doc.getObject(objectid[0])
.then(model => {
var margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 650 - margin.left - margin.right,
@mindspank
mindspank / embedsheet.js
Last active January 17, 2022 05:16
Emulate a Qlik Sense sheet using the Capabilities API
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );
@mindspank
mindspank / 0_reuse_code.js
Created April 15, 2016 20:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
const qsocks = require('qsocks');
// Get a global reference
var global = qsocks.Connect();
global.then(function(global) {
return global.createApp('This is my app3');
})
.then(function(reply) {
// Establish a new connection so we don't pollute the current engine session.
@mindspank
mindspank / changescriptinpublishedapp.js
Last active April 15, 2016 20:41
Change Script in Published app
const qsocks = require('qsocks');
const fs = require('fs');
// Our Qlik Sense Certificates
const client = fs.readFileSync('C:\\ProgramData\\Qlik\\Sense\\Repository\\Exported Certificates\\.Local Certificates\\client.pem');
const client_key = fs.readFileSync('C:\\ProgramData\\Qlik\\Sense\\Repository\\Exported Certificates\\.Local Certificates\\client_key.pem');
const config = {
host: 'localhost',
port: 4747, // Standard Engine port
@mindspank
mindspank / qsocks.js
Last active April 15, 2016 20:41
qsocks 2.2 and listen for change events #engineapi #qsocks
var qsocks = require('qsocks');
// ConnectOpenApp requires a appname property.
// Returns an array of [globalhandle, apphandle]
var connection = qsocks.ConnectOpenApp({
host: 'localhost',
isSecure: true,
rejectUnauthorized: false,
appname: '7c876a9a-d62d-49ea-b21c-aaccda76c067',
debug: true
@mindspank
mindspank / dump.js
Last active March 24, 2016 04:56
ObjectDump
var qsocks = require('qsocks');
var Promise = require('bluebird');
var fs = require('fs-extra');
var config = {
isSecure: true,
host: '<HOSTNAME>',
port: 4747,
headers: {
'X-Qlik-User': 'UserDirectory=Internal;UserId=sa_repository'
@mindspank
mindspank / hypercubesample.js
Last active January 18, 2022 04:13
HyperCube Sample #engineapi #qsocks
const qsocks = require('qsocks');
qsocks.Connect({
host: 'branch.qlik.com',
prefix: 'anon',
isSecure: true
})
.then(function(global) {
return global.openDoc('3f3a866b-238f-4d1a-8aeb-81e97756af7a')
})
const request = require('request');
const qsocks = require('qsocks');
const fs = require('fs');
// Qlik Sense App ids
const appIds = ['efdf4130-7b89-45f6-8639-179666f3e35c',
'87c2d436-b9b0-4414-8fa1-f5289627b34e',
'b0d3a00d-798b-4e34-8e7c-ab06caa54567',
'69a8c183-8bc7-4aa4-8ad1-192dbf4d60f8',
'1158e903-446f-4092-bed1-beb748a209b3',