Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II

TextAlign property handling

I am struggling with how to handle text alignment from my hypercube. On measureinfo property there is a TextAlign property but that property value is wrong. My QlikSense object is aligning "Right" and that property is "Left". I have found a workaround where I read the entire JObject and from that pick out the Representation property which in turn contains an IndicatorProps.Position property where alignment is the correct value "Right".  This is definately not how it is supposed to be done but I cant come up with any other solution. Would be forever grateful if someone has a solution for this so I can remove my custom code for fetching such a trivial design property. 

Attaching some screenshots on the data

Labels (2)
12 Replies
andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

Ok, sorry, never used the actual QlikSense UI, only integrated to it. But here is the .qvf file.

alex_colombo
Employee
Employee

Hi @andreas-hellquist-stratsys , thanks for sharing the app.

I made a couple of test and this is how product works. When Text Alignment property is set to "auto", default alignments will be applies. For text values alignment is on the left, for numbers and dates is on the right. Looking at the property with GatLayout method we will see

"textAlign": {
	"auto": true,
	"align": "left"
}

This means that in this particular case, the align property is not considered by the product, because "auto" prop is set to true. Could make confusion here, but this is how it works. Align is set to true beucase is the default value. Indeed, when you switch off the auto prop in the UI you will see align left set as default. See below screenshot

alex_colombo_0-1677054429099.png

 

If I force position to right, then in properties you will see align "right"

alex_colombo_1-1677054468993.png

Then, here what we have in the GetLayout method

"textAlign": {
	"auto": false,
	"align": "right"
}

 

Finally, when auto is set to true, you will know that text are on left and dates and numbers on right. When auto is set to false, then read align value.

andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

Thank you very much for the great explanation! It was slightly confusing but now I know how to sort it out at least. Right now I just check for type of data in column and align by that.