sense-calendar-heatmap
Version:
Qlik Sense Visualization Extension with a diverging color scale. The values are displayed as colored cells per day. Days are arranged into columns by week, then grouped by month and years.
1 lines • 1.71 kB
JavaScript
define(["jquery","underscore","angular","qlik","./properties","./initialproperties","./lib/js/extensionUtils","text!./lib/css/main.css","text!./swr-calendarheatmap.ng.html","./lib/directives/swr-simpletable/swr-simpletable","./lib/directives/swr-calendarview/swr-calendarview"],function(e,t,a,r,i,s,o,u,n){"use strict";function q(e){var a=[];if(e)for(var r=-1,i=0;i<e.qHyperCube.qDataPages[0].qMatrix.length;i++)if(r++,!e.qHyperCube.qDataPages[0].qMatrix[i][0].qIsEmpty&&!e.qHyperCube.qDataPages[0].qMatrix[i][0].qIsNull){var s=e.qHyperCube.qDataPages[0].qMatrix[i][0].qText,o=parseFloat(e.qHyperCube.qDataPages[0].qMatrix[i][1].qNum),u=t.isEmpty(e.qHyperCube.qDataPages[0].qMatrix[i][1].qText)?"Value: "+o:e.qHyperCube.qDataPages[0].qMatrix[i][1].qText;a[r]={Date:s,Measure:o,ToolTip:u}}return a}return o.addStyleToHeader(u),{definition:i,initialProperties:s,snapshot:{canTakeSnapshot:!0},template:n,controller:["$scope",function(e){function i(){if(e.hyperCube&&(s.destroySessionObject?s.destroySessionObject(e.hyperCube.qInfo.qId).then(function(e){a.noop(),void 0}):o.destroyObj(s,e.hyperCube.qInfo.qId)),e.layout.props&&!t.isEmpty(e.layout.props.uniqueDay)&&!t.isEmpty(e.layout.props.uniqueDayValue)){var r={qDimensions:[{qDef:{qFieldDefs:[e.layout.props.uniqueDay],qSortCriterias:[{qSortByAscii:1}]}}],qMeasures:[{qDef:{qDef:"="+e.layout.props.uniqueDayValue}},{qDef:{qDef:"="+(t.isEmpty(e.layout.props.uniqueDayTooltip)?"''":e.layout.props.uniqueDayTooltip)}}],qInterColumnSortOrder:[0,1],qInitialDataFetch:[{qTop:0,qLeft:0,qHeight:1500,qWidth:3}]};s.createCube(r,function(t){e.hyperCube=t,e.data=q(t)})}}var s=r.currApp();e.hyperCube=null,e.data=null,e.$watchCollection("layout.props",function(){i()})}]}});