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: 
Not applicable

Hide trendline

Hi there,

This is my first post, so hopefully someone can help me.

My client wants a trendline which if certain conditions are met (below a certain threshold), to hide it.

So then there would be the possibility that you see a trendline, nothing, and then the trendline again.

I tried to set a condition on the trendline, but it's not working. No problem with a dotted line for values below a certain threshold, but I can't make it disappear.

The dotted formula: If(Count(Distinct theshold_value) < 100,'<W0><S3>')

I also tried to use the HSL, but it's not working, to make the line transparent, but it's not working..

If someone knows the/a solution, please let me know.

Best regards,

Arjan

1 Solution

Accepted Solutions
Not applicable
Author

Finally I found a way to hide the trendline based on condiftions.

I can make the trendline fully transparent with the following condition as background color:

if(sum(Value)<=below(sum(Value)),ARGB(0,0,0,0),lightgreen())

The first 0 in ARGB makes sure it's fully transparent, so I can still use any background color i want.

Hopefully someone can use this..

View solution in original post

5 Replies
pljsoftware
Creator III
Creator III

Hi

you must to use a macro that show your trend line when you press a button for example.

'Get chart object
set graph1 = ActiveDocument.GetSheetObject(chartID) 'charID can be for i.g. "CH100"

graph.AddTrend 0,1,1 'Lineare
graph.RemoveTrend 0,1,1 'Lineare

set graphProp = graph.GetProperties
graph.SetProperties graphProp



Regards
Luca

Not applicable
Author

Thanks Luca, for the very quick response...

It's not quite what I mean.. I guess I didn't explain it well enough..

i.e.

A trendline for the last 12 months. But when a value is lower then 100 i.e. for the month of May I don't want to show the trendline for that specific month. So then you you the line from Jan-Apr and from Jun-Dec. I know I can change the properties of the line (thickness, type), but I can't seem to be able to amke it disappear for a month, or make the line the same color as the background for a specific month.

Not applicable
Author

Finally I found a way to hide the trendline based on condiftions.

I can make the trendline fully transparent with the following condition as background color:

if(sum(Value)<=below(sum(Value)),ARGB(0,0,0,0),lightgreen())

The first 0 in ARGB makes sure it's fully transparent, so I can still use any background color i want.

Hopefully someone can use this..

Not applicable
Author

Are you using a line graph with the trendline setting and setting the backgroung color for the expression?

That is what I am doing in one case and I can't make the trendline disappear conditionally or for that matter, even if I set the background color to =ARGB(0,0,0,0).

Am I missing something?

Not applicable
Author

Hi Luca,

I found your answer helpful to my case.

One thing I wonder - how do you toggle between the trendline show/hide in the macro?

Is this done with a variable?

Thanks!