Can I create graphs in ASP pages?

Simple enough question right in the title. I would like to create a web page (.asp) with a line graph in it. I need to do this without purchasing any additional software or installing anything on the server.


I’m not sure about this. ASP is a great language for generating HTML code, but you can’t render line graphs directly in HTML, and ASP doesn’t let you work with image files directly.

The most obvious choices I can think of are getting a COM library to draw your images, (which would need to be installed,) or maybe writing a Java applet that will do the drawing for you. Once the java applet is compiled, you can just put the compiled CLASS file in the same folder with your ASP pages to get downloaded, and include the <applet> tag (or plugin? embed? I can’t remember the ‘right’ way to call applets currently,) with appropriate parameters written in from ASP to convey the data you’re attempting to graph.

I think I have a similar example lying around for pie charts. Let me know if you want code samples.

Not with ASP.

But if you can use your ASP sk1llz to generate XML, you can use any number of client-side Flash-based graph drawing gizmos. My favorite is FusionCharts. Check out their cool line graph demos.

Technically you COULD use colors, 1x1 images and pixel sizes and whatnot to “draw” a graph in ASP-generated HTML. But it might be a pain in the ass depending on your data.

We use FusionCharts, too, in our ASP apps.

For VERY crude line graphs you could create a 100 x 100 table of, say, 10px x 10px tablecells. This would represent your graphing surface and be surrounded by axes, tick marks, labels, legends etc.

Then suitable asp code could set the background color style of any or all of the “pixels” of your graph surface. If you wanted dynamic behavior, move the pixel control to javascript on the browser.

We’re talking really ghastly here, but it does work.

Here is an example of a similar idea used to implement an analog clock. Consider the moving hands to be graphs of a function & you get the idea. Hint: this guys’ stuff is not good. There are much better implementations out there.

ETA: **ZipperJJ **beat me to it.

For a .net application, I’ve used Dundas Charting before. It’s not free, tho.

I’m looking at FusionCharts right now. If that doesn’t work, I’ll try the 100x100 table idea. If that doesn’t work, well, then, tough noogies for the people who want that feature.


Thanks once again for the FusionCharts. They are awesome!

I just showed it to the database coordinator, and I swear she almost had the Big O. I’m almost hesitant to show it to the program director. I’ll be making graphs for the next 5 years, on every possible metric.