Enjoy an ad free experience by logging in. Not a member yet? Register.

Results 1 to 7 of 7
Thread: Return of the SVG Grapher

12152002, 10:38 PM #1
Return of the SVG Grapher
I just rewrote my SVG grapher sans conics so that it doesn't suck.
Polar graphing is usable, and you can change the window settings around now. I also added support for parametric equations.
I haven't gotten around to adding conics back yet, but I promise they'll be back and better than ever.
Of course, you'll need an SVG enabled build of Mozilla to view this.
Windows users, you should get a GDI+ build (this is off the 1.3 trunk):
http://www.croczilla.com/svg/mozilla...s20021128.zip
Other OS's, you hunt around for a libart build at Mozilla.org.
Here is it:
http://www.jasonkarldavis.com/script...er/grapher.xml
For the underprivileged surfers who aren't using Mozilla (or don't have an SVGenabled build), you can look at a screenshot here:
http://www.jasonkarldavis.com/grapher.png
Other than adding conics, I need to allow the user to redraw graphs on resize (zoom out after graphing to see why), selectively clear certain graphs, and probably implement a degrees mode.
A XUL Sidebar version is next on my list after these, followed by an IE port using the Adobe SVG Viewer.
What are your thoughts?

12152002, 11:04 PM #2
 Join Date
 Sep 2002
 Location
 Louisiana
 Posts
 576
 Thanks
 0
 Thanked 0 Times in 0 Posts
it isn't working for me, i am using mozilla 1.01?

12152002, 11:47 PM #3
Like I said, you need an SVGenabled build of Mozilla.
There are libart builds at Mozilla.org, but I recommend the GDI+ build from the Croczilla link I posted above.

12162002, 01:46 AM #4
 Join Date
 Nov 2002
 Location
 Bristol, UK
 Posts
 932
 Thanks
 0
 Thanked 0 Times in 0 Posts
it's excellent, as usual
glad you took my advice and rewrote it... when you have finished the sidebar version I can see myself using that
I think an IE port would be very kind!
::] krycek [::ithium  SOAPI  SDP  PTPScript manual
"ithium is a nonprofit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy nonprofit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

12182002, 04:32 AM #5
 Join Date
 Jun 2002
 Location
 near Oswestry
 Posts
 4,508
 Thanks
 0
 Thanked 0 Times in 0 Posts
Looks very cool man ... but I so don't understand the maths
Can you post some sample equations that yield funkylooking graphs

12182002, 05:59 AM #6
Graphing anything with Math.random() instantly looks very cool and provides a visual look at the pseudorandomness of Javascript.
r = Math.random()*5
Nice jagged circle
f(x) = Math.random()*x
Nice line (triangles really). Graph on top of y = 0.5*x to see the supposed average value.
As for pretty curves, polar coordinates are really good at that.
r = t
is a spiral.
You can make flowers by
r = Math.sin(c*t)
and
r = Math.cos(c*t)
where c is some constant.
Etc etc
An interesting function kind of popular in Calc courses is
f(x) = Math.sin(1/x)
Because it oscillates infinitely between 0 and 1 as x approaches 0
Just a classic one:
f(x) = Math.sin(x)/x
which you can prove approaches 1 as x approaches zero by what is known as the sandwich theorem.

01062003, 09:02 PM #7
I know some people are still interested, but here is a sidebar version written in XUL:
http://www.jasonkarldavis.com/script...ul/grapher.xul
Even if you don't have an SVGenabled build, you can still check out the tabbed interface...
There is currently a regression in window settings (they kinda work, but I don't know what exactly is going on), and hyperbola graphing isn't up to par yet. (I'm working on approximating hyperbolas by quadratic bezier curves...)
But the other 3 conic sections work a treat (and parabola graphing has been improved by converting it into a quadratic bezier curve instead of plugging and chugging lineto's).
There are still some problems with graphing functions that approach infinity very quickly as x approaches 0, but I think I have an idea to fix it (at cost of some accuracy for certain window settings  but then again you really can't accurately graph infinity, so...).
When this is finished, I intend to put it in an installable XPI instead of having the sidebar on the server (save some bandwith). Hopefully I can get hyperbolas worked out today, along with the window settings issues.
In the future I intend to add in support to select previously graphed functions, and remove them, as currently once they are grapher, they are permanent. You have to reset everything to remove it, which isn't always preferable.