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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
rbecher
MVP
MVP

Free Lines/Angles in a Line Chart

Is there any possibility to add free lines or angles into a line chart?

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Sorry, yes, y = 0.5 * X + 4.5 is 22.5 degrees. (edit: Gah! It's about 26.565 degrees. I'm totally failing at math today.) From(x = 1, y = 5, degree = 45) is = x + 4. My bad at messing up a simple algebraic transformation, but the principle still holds - all it takes is simple algebra. Now, if you go plug = x + 4 into the graph, you'll STILL notice that it isn't 45 degrees, but that's because the SCALES are different. If the scales were the same, it would be 45 degrees.

As for starting only at month 3, the answer to that is my previous suggestion: " If you don't want lines, and just want line segments, then you'll probably need to additionally set the value to null outside of the range you want, and suppress nulls."

So here's the example again. This time, I'm using the formula = x + 4, I've made the two scales match (same length vertically from 0 to 6 as horizontally from 0 to 6), and I've set the value to null outside the range you want, and I've suppressed 0 values. You now have a 45 degree line that starts at 3,7.

View solution in original post

11 Replies
Anonymous
Not applicable

Waht about using Refernce Lines?

johnw
Champion III
Champion III

Or an extra table of data corresponding to the lines or angles you want displayed.

rbecher
MVP
MVP
Author

those lines are vertical or horizontal, not stantwise

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
johnw
Champion III
Champion III

Example of my suggestion with slanted "reference lines" is attached.

Anonymous
Not applicable

John,
Your solution works without these extra fields Target and Min. YOu can simply use expressions like
A*Month + B
where A and B are constants. For example:
1.5*Month + 5

johnw
Champion III
Champion III

Ah, yeah. I guess I'm used to using "reference lines" that are loaded from a database, or otherwise have specific values not based on a formula. A table is silly overkill for something as simple as a slanted line. Bad suggestion on my part.

(edit: Example corrected to show Target "loaded from a database" and Min based on a formula.)

(edit: Example further corrected with Type field on main table. Demonstrates why main table isn't merged with the reference line table.)

rbecher
MVP
MVP
Author

John,

thanks, this is an interesting approach but I'm looking for something like from(x,y) to(x,y) or from(x,y,degree) .

Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
johnw
Champion III
Champion III

Your two examples are just ways of specifying a line. So is the example I gave. You just need to do a little math to put your linear equations in slope intercept form, which is a form that QlikView understands: y = slope * x + value where line intercepts y axis.

If you want:

From(x = 1, y = 5, degree = 45)

Then you want:

= 0.5 * x + 4.5

If you want:

From(x = 10, y = 20) to (x = 20, y = 40)

Then you want:

= 2 * x + 0

If you don't want lines, and just want line segments, then you'll probably need to additionally set the value to null outside of the range you want, and suppress nulls.

(edit: My terminology may not be exactly correct. I can do the math, but math terminology always eludes me.)

rbecher
MVP
MVP
Author

I adapted your 45 degree formula to your example and you can see it's not 45 degree 😉 And, how to start at month 3?

So, this is a more complex question.

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine