Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to use a button to change chart setting

My query:

usually we can change our chart setting in its property.

eg. I can add values on data points in the chart-property-expressions

I wonder whether it is possible to add such a button

when I press it, the values show on the data.

when I press it again, the values disappear.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can use a variable to change the text color of the values, effectively hiding or showing them. See attached example.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
Not applicable
Author

Dear,

kindly find the attachment .

i hope it will help you.

Thanks,

Mukram.

Gysbert_Wassenaar

You can use a variable to change the text color of the values, effectively hiding or showing them. See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

The way I usually do is that I actually create 2 charts and a list box.

Say you want to view the values on data point:

  • Add a table in your script as follows:

Show_Values:

LOAD * INLINE [

ShowVal

Show values

]

;

  • Create a listbox (checkbox) with ShowVal
  • create a chart with value on datapoint. Add a condition on the layout: if(ShowVal='Show values',1,0)
  • copy the first chart but untick show value on data point and add the condition:  if(ShowVal<>'Show values',1,0)

If you're using Qlikview 11, no need to have 2 charts. Just us the conditional expressions.

That would work

Not applicable
Author

dear,

did you attach it?

Not applicable
Author

Thanks!

it works and really thought-provoking

Not applicable
Author

Hi Gysbert,

I downloaded your examplea and tried to understand how you achieved it. Can you explain a bit about how did the trigger on button connected with the chart. ? and also what does "=(not vShowValues)*-255" mean ?

Thanks

Angad

Gysbert_Wassenaar

The button has an action assigned to it to change the value of the vShowValues variable. The chart uses the value of the variable for the text color of the values. So if the button changes the value it's immediatly changed in the chart too. There's no document or sheet trigger involved.

The expression for the text color is black($(vShowValues)). The variable vShowValues is used for the alpha parameter of the black() color function. It determines how solid the color is. black(0) is totally transparant, black(255) is solid black.

The formula =(not vShowValues)*-255 flips the value of the variable between 0 and 255. It treats vShowValues as a boolean. If it has the value 0 then not vShowValues returns -1, if it has a value other than 0 it returns 0. By multiplying the result of not vShowValues (0 or -1) with -255 I get either 0 or 255.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert. That really made sense and thank you once again for the detailed explanation.

Anonymous
Not applicable
Author

hi gysbert,

thanks for the tip, but how do you create the variable?

i'm trying to make a button that changes currency in a table, but i cant form the variable to control the currency presented.

thanks again

Avner