Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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.

Tags (2)
1 Solution

Accepted Solutions

Re: how to use a button to change chart setting

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
9 Replies
Not applicable

Re: how to use a button to change chart setting

Dear,

kindly find the attachment .

i hope it will help you.

Thanks,

Mukram.

Re: how to use a button to change chart setting

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

Re: how to use a button to change chart setting

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

Re: how to use a button to change chart setting

dear,

did you attach it?

Not applicable

Re: how to use a button to change chart setting

Thanks!

it works and really thought-provoking

Not applicable

Re: how to use a button to change chart setting

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

Re: how to use a button to change chart setting

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

Re: how to use a button to change chart setting

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

avner_raz
New Contributor III

Re: how to use a button to change chart setting

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

Community Browser