Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I would like to define the coloring option by expression in the properties panel of a visualization extension.
I looked at several extensions and none of them have used any expressions in the properties panel excluding dimension, measure, and appearance > general panes which are all auto created/defined parts of the properties panel, having no setting attributes in the js file.
When I tried the expression: "always" element in the js file I got the orange fx sign show up in the properties panel but the calculations were not carried out...
Any kind of help would be greatly appreciated!
I have written this code inside of dimention shown below:
definition : {
type : "items",
component : "accordion",
items : {
dimensions : {
uses : "dimensions",
min : 1,
items: {
colorExpression:{
type: "string",
label: "Enter color expression",
ref:"qAttributeExpressions.0.qExpression",
expression:"optional"
}
}
},
now please tell me what should I need to write inside of function
paint: function ($element,layout) {
this.backendApi.eachDataRow( function (rownum, row){
var dimIndex = 0; // you are putting the value in your first dimension
row[dimIndex].qAttrExps.qValues[0].qText;
});
if ( !this.$scope.table ) {
this.$scope.table = qlik.table(this);
}
return qlik.Promise.resolve();
}
but Sir , this is not working for me.
please give me any solution
The expression: row[dimIndex].qAttrExps.qValues[0].qText;
should have the calculated color expression. You'll need to save those in an array.
Beyond that I don't know how to actually background color columns of the table. You'll have to figure it out with the Visualization API I believe. Good luck.
humesh_sindpure Here is my active code where I use color expressions.
https://github.com/jonvitale/SenseColorableSankey/blob/master/SenseColorableSankey.js
Hi Jonathan
Can you please share the code
Sorry, I don't actually have the code for this because I wound up going in a different direction. I had the idea to use a measure to define the color of something, but then decided that I needed the color to be related to dimensions. So, I wound up using an expression in each dimension to color the representation of that dimension. So, in my dimension I use a reference like, "qAttributeExpressions.0.qExpression" and then access with something like, "row.qAttrExps.qValues[0].qText", where I'm iterating over the rows of the hypercube with this, "this.backendApi.eachDataRow(function(rownum, row){..."
You can see my code here:
https://github.com/jonvitale/SenseColorableSankey/blob/master/SenseColorableSankey.js