This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.visualization.create( 'pivot-table', | |
[ | |
"Year", //dimension | |
{"qDef" : { "qFieldDefs" : ["Case Owner Group"], "qFieldLabels" : ["Group"] }}, //dimension with label | |
{"qDef" : { "qDef" : "=Avg([Case Duration Time])", "qLabel" : "Avg Case Duration Time" }},//measure with label | |
{"qDef" : { "qDef" : "Sum( [Open Cases] )", "qLabel" : "Open Cases" }} //measure with label | |
], | |
{"title" : "Case Owner Group Case stats per year"} | |
).then( function ( visual ) { | |
visual.show( 'QV01' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.visualization.create( 'barchart', | |
[{ | |
qDef: {qFieldDefs: ["Case Owner Group"]}, //dimension field | |
qOtherTotalSpec: {qOtherMode: "OTHER_COUNTED", qOtherCounted: "5"} //top 5 values | |
}, | |
"=Avg([Case Duration Time])"], //measure | |
{"title": "On the fly chart"} | |
).then( function ( barchart ) { | |
barchart.show( 'QV01' ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add a new chart when the user clicks in the list of visualizations | |
vislist.delegate( 'a[data-id]', "click", function ( e ) { | |
var id = $( this ).data( 'id' ); | |
addChart( app, id ); | |
} ); | |
// dynamically add a visualization to the tabs | |
function addChart ( app, id ) { | |
//create a tab container if it does not exist | |
if ( !tabContainer ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//getObject returns a promise, so we use the then method to get the model | |
app.getObject( tabid, id, options ).then( function ( model ) { | |
//save the model for future use | |
tabContainer.visualizations[tabid] = model; | |
//the title will be in the model | |
tabContainer.setTitle( model, tabid ); | |
//the Validated event will be triggered when there is new data | |
//use it to update the title | |
model.Validated.bind( function () { | |
tabContainer.setTitle( this, tabid ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reOrder ( vis, sortOrder, col ) { | |
// set the new column first in the new sortorder array | |
var newOrder = [col]; | |
//append all other columns from the current sort order | |
sortOrder.forEach( function ( val ) { | |
if ( val !== newOrder[0] ) { | |
newOrder.push( val ); | |
} | |
} ); | |
var patches = [{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FieldList ( app ) { | |
/*....*/ | |
app.getList( 'CurrentSelections', function ( reply ) { | |
me.selections = reply.qSelectionObject.qSelections; | |
//render since selections have changed | |
me.render(); | |
//use qBackCount and qForwardCount to enable/disable back and forward buttons | |
$( "[data-qcmd='back']" ).toggleClass( 'disabled', reply.qSelectionObject.qBackCount < 1 ); | |
$( "[data-qcmd='forward']" ).toggleClass( 'disabled', reply.qSelectionObject.qForwardCount < 1 ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//check if we are in personal mode(desktop) or not | |
var global = qlik.getGlobal( config ), isPersonalMode; | |
global.isPersonalMode( function ( reply ) { | |
isPersonalMode = reply.qReturn; | |
} ); | |
/*..*/ | |
if ( isPersonalMode ) { | |
app.doReload().then( function () { | |
app.doSave(); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initialProperties : { | |
version: 1.0, | |
qHyperCubeDef : { | |
qDimensions : [], | |
qMeasures : [], | |
qInitialDataFetch : [{ | |
qWidth : 2, | |
qHeight : 50 | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return { | |
type: "items", | |
component: "accordion", | |
items: { | |
dimensions: { | |
uses: "dimensions", | |
min: 1, | |
max: 1 | |
}, | |
measures: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.createCube( { | |
"qInitialDataFetch": [ | |
{ | |
"qHeight": 400, | |
"qWidth": 8 | |
} | |
], | |
"qDimensions": [ | |
{ "qDef": {"qFieldDefs": ["CaseNumber"]} }, | |
{ "qDef": {"qFieldDefs": ["Status"]} }, |
OlderNewer