SVG Graphing

This article address the following problem. How do you compute something and graph the result on a modern PC, without any specialized math software, even without Microsoft Office?

Of course, there're tons of different solutions.

However, most of them starts with “buy and install…” or at least “download and install…”. While the point was “what if you have just a modern PC with modern OS, nothing else, not even the Internet?”.

The topic starter (Russian only) stated that MS DOS 6.22 + QBasic, as well as programmable calculators, are more suitable for engineers then the modern era PCs.

I sorta disagreed with that. I wrote a ECMAScript code running inside the containing SVG to calculate the data, and add one more polyline to the SVG DOM.

In the real life you'd rather install e.g. Maple, so this article contains very little copy-paste value.

I'd like to note however, that the SVG format does deserve much closer attention. For example, you can output zoomable vector polylines, along with the coordinate grid, with just a few fprintf calls. While I've been working on the software that directs some inductrial robot, such SVG diagnostic output proved to be very handy.

To calculate and display the graph below, all you need is a web browser that supports SVG. I recommend Opera browser, but the rest of them should work, too. The Internet Explorer needs the SVG plugin by Adobe to do that, but this is gonna change when the IE9 will be shipped.

And here's the SVG source code:

April, 2009