Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Nicole-Smith

Label for Expression in Extension

Right now, in all of my extensions (and all of the extensions that I can find from other people), the labels for my expressions are just the expression itself.  Is there a way to have the user define a label for the expression?  I know I would need to put some type of input box in the .qvpp file, but I'm not quite sure how to go about doing this.  Any help would be greatly appreciated.  Thanks!

9 Replies
ErikWetterberg

The easiest way would be to use Text properties for labels.

Erik

Nicole-Smith
Author

I'm sorry Erik, I'm not quite sure what you mean, and maybe I'm not explaining myself properly.

Currently, what I am able to do in my script.js is to use this.Data.HeaderRows[0] to get the Dimension and Expression that the user chose to make the chart.  So if I have one dimension (Clothing) and one expression (sum(Sales)), this.Data.HeaderRows[0][0] returns Clothing and this.Data.HeaderRows[0][1] returns sum(Sales).  However, what I want to do is allow the user to give a name to sum(Sales) since they may want to name it "Total Sales" or something else.  So, what I really want to do is to put an input box on the properties page that works like this input box on a regular chart object, see below (however, I don't know what syntax I need in order to include this in the .qvpp file):

ExpressionLabel.png

ErikWetterberg

Yes, I do understand what you mean. The easiest way to let your users enter a label would be to add a Text tag to your definition.xml:

<Text Label="Label:" Initial=""/>

In your javascript you can then find the label at this.Layout.Text0.text (if it is your fist Text tag).

Erik

Nicole-Smith
Author

Thank you, Erik.  Your posts are always very helpful.

However, you mentioned that this is the easiest way to do it.  Is there another way (although possibly harder) that would allow labels for a dynamic number of expressions?

Anonymous
Not applicable

I'm also interested in being able to create a dynamic number of labels for expressions as well !  Anyone have any ideas ?

Thanks )

Not applicable

Is there a way to have dynamic legends/labels for expression on the chart? 

Suppose, per tutorial, we have quantity and revenue as a cyclic group in two expression.  When I change the expression, I would like to see Quantity as the label or legend in the chart, and ditto for Revenue, so I know whether I am looking at Quantity or Revenue.  But the chart only shows the chart title set in the general tab, for example, Quantity, and it does not vary dynamically, and this is not correct. 

I have asked this question before and have not obtained an answer.  I have been playing with this and don't know how to get around this. 

Seems like a flaw.

Not applicable

Is there a way to have dynamic legends/labels for expression on the chart? 

Suppose, per tutorial, we have quantity and revenue as a cyclic group in two expression.  When I change the expression, I would like to see Quantity as the label or legend in the chart, and ditto for Revenue, so I know whether I am looking at Quantity or Revenue.  But the chart only shows the chart title set in the general tab, for example, Quantity, and it does not vary dynamically, and this is not correct. 

I have asked this question before and have not obtained an answer.  I have been playing with this and don't know how to get around this. 

Seems like a flaw.

Not applicable

Hi Nicole,

I am also looking for the same solution for the problem being discussed in this thread. Were you able to figure out a way for adding the dynamic labels for extension objects ?

Thanks,

Puneet.

patrik_seger
Partner - Creator
Partner - Creator

Hi Puneet

I interpret Erik’s answer that a Dynamic label is something that you can handle yourself, by using a Text tag. Then just use this text instead of the name of the expression.

Ideally, you would like to have this dynamic, so that the number of label input fields is the same as the number of expressions, but this may be complicated to solve (maybe use Document Extensions?). An easier path is to have one input field that takes all labels (comma separated). Not so nice, but a possible way forward.

Have a look at Stefan Walthers excellent example to see how he solved the labeling (although not dynamic number of expressions):

http://www.qlikblog.at/2574/qlikview-extension-animated-scatter-chart/

Br Patrik