Draw a (pseudo) infinite line that reachs the viewport?

541 views
Skip to first unread message

Filipe A Moreira

unread,
Jun 12, 2011, 6:12:31 PM6/12/11
to raph...@googlegroups.com
Hi all,

This is the first time I am using Raphael.js (and SVG for that matter) and while building a line graph application I got stuck and need your help. What is the best way to draw a line that passes through two points and reach the viewport? Please check this mockup that shows what I want to achieve (http://dl.dropbox.com/u/21337/InfiniteLine.png).

Any help is appreciated.

Thank

mkeblx

unread,
Jun 16, 2011, 7:02:19 PM6/16/11
to raph...@googlegroups.com
Figure out the equations of the lines that would define the sides of the viewport, which ViewBox (http://raphaeljs.com/2.0/#Paper.setViewBox) attributes you should be keeping track of for a graphing app. Then find the line-line intersections and draw a line between the intersection points. Or, which might be simpler, just draw a line that you know is bigger than the viewBox.

Reply all
Reply to author
Forward
0 new messages