Skip to content

Instantly share code, notes, and snippets.

Avatar

Ralf Becher ralfbecher

View GitHub Profile
View d3proposal.js
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') }
};
@ralfbecher
ralfbecher / qlikNumberFromDate.js
Created May 16, 2016
JavaScript function to get QlikView or Qlik Sense numerical Date value from JavaScript Date
View qlikNumberFromDate.js
function qlikNumberFromDate(d) {
return d.getTime() / 86400000 + 25569;
}
View gist:70d4aa7616361b4225d595b2edcd397b
(function() {
(function foo(node) {
if (node && node.$id) {
if (node.$$childHead) foo(node.$$childHead);
if (node.$$nextSibling) foo(node.$$nextSibling);
if (node.model && node.model.layout) node.model.layout.title = node.model.id;
}
})(qvangularGlobal.$rootScope);
$('*').css('-webkit-user-select', 'all');
pubsub.publish('/resize/end')
View require url.js
define( ["require"], function ( localRequire ) {
var path = localRequire.toUrl( "extensions/d3-vis-library/d3-vis-library.css" );
});
@ralfbecher
ralfbecher / QlikView_Scatter_Chart_determined_bubble_size.qvs
Last active Feb 12, 2016
QlikView Scatter Chart determined bubble size
View QlikView_Scatter_Chart_determined_bubble_size.qvs
// third expression:
dual( sum(Volume), sqrt( sum(Volume) ) )
// or
dual( sum(Betrag), pow( sum(Betrag), 0.7 ) )
@ralfbecher
ralfbecher / QlikView_Row-based_Transparent_Colors.qvs
Created Feb 12, 2016
QlikView Row-based Transparent Colors
View QlikView_Row-based_Transparent_Colors.qvs
// can be used in scatter chart to have persistend color for dimensions and nice opacity for overlapping bubbles:
=argb(180,
subfield(textbetween(color(RowNo()),'(',')'),',',1),
subfield(textbetween(color(RowNo()),'(',')'),',',2),
subfield(textbetween(color(RowNo()),'(',')'),',',3))
@ralfbecher
ralfbecher / Qlik_Expression_Baskets_ordered_by_Frequency.qvs
Last active Feb 5, 2016
Qlik Expression Baskets ordered by Frequency
View Qlik_Expression_Baskets_ordered_by_Frequency.qvs
// Baskets order by Frequency:
Concat(DISTINCT Product, ',', -Aggr(NODISTINCT Count(Product), Product))
@ralfbecher
ralfbecher / QlikView_Extension_determine_amount_of_Dimensions.js
Created Jan 4, 2016
QlikView Extension determine amount of Dimensions from first data row (if multiple)
View QlikView_Extension_determine_amount_of_Dimensions.js
// get amount of Dimensions
var nDimensions = this.Data.Rows[0].filter(function(col){return !(col.color == undefined);}).length;
@ralfbecher
ralfbecher / QlikView_Haversine_formula.qvs
Created Dec 16, 2015
QlikView Haversine formula calculation
View QlikView_Haversine_formula.qvs
// calculation of distance of two geo references (lat/lon):
= 12742 * atan2(sqrt(sqr(sin(((lat2-lat1)*PI()/180)/2))
+ (cos(lat1*PI()/180) * cos(lat2*PI()/180))
* pow(sin(((lon2-lon1)*PI()/180)/2),2)),
sqrt(1 - (sqr(sin(((lat2-lat1)*PI()/180)/2))
+ (cos(lat1*PI()/180) * cos(lat2*PI()/180))
* pow(sin(((lon2-lon1)*PI()/180)/2),2))))
@ralfbecher
ralfbecher / QlikView_Expression_NewProductPerYear.qvs
Last active Oct 21, 2015
QlikView Chart Expression Counts New Products/Year
View QlikView_Expression_NewProductPerYear.qvs
data:
LOAD * INLINE [
Year, Product
2010, P1
2011, P1
2012, P1
2010, P2
2011, P2
2011, P3
2012, P3
You can’t perform that action at this time.